Switch to firefox
This commit is contained in:
parent
00f3bc4ffd
commit
10fb02c90d
@ -19,7 +19,7 @@ RUN apt-get update && \
|
|||||||
build-essential \
|
build-essential \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
chromium \
|
firefox \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,6 @@ import os
|
|||||||
|
|
||||||
TELEGRAM_TOKEN = os.environ.get("SECRETARX_TG_TOKEN", None)
|
TELEGRAM_TOKEN = os.environ.get("SECRETARX_TG_TOKEN", None)
|
||||||
DB_PATH = "data.db"
|
DB_PATH = "data.db"
|
||||||
CHROMEDRIVER_PATH = "chromedriver"
|
|
||||||
|
|
||||||
|
|
||||||
LISTEN_PORT = 9090
|
LISTEN_PORT = 9090
|
||||||
GOOGLE_CLIENT_SECRET_FILE = "credentials.json"
|
GOOGLE_CLIENT_SECRET_FILE = "credentials.json"
|
||||||
|
|||||||
11
xclient.py
11
xclient.py
@ -34,16 +34,12 @@ class XClient:
|
|||||||
|
|
||||||
def fetch_access_token(self):
|
def fetch_access_token(self):
|
||||||
# Set up the WebDriver (make sure to use the correct path for your WebDriver)
|
# Set up the WebDriver (make sure to use the correct path for your WebDriver)
|
||||||
service = Service(executable_path=config.CHROMEDRIVER_PATH)
|
driver = webdriver.Firefox()
|
||||||
|
|
||||||
options = webdriver.ChromeOptions()
|
|
||||||
options.add_argument("--headless=new")
|
|
||||||
options.add_argument("--no-sandbox")
|
|
||||||
|
|
||||||
driver = webdriver.Chrome(options=options, service=service)
|
|
||||||
|
|
||||||
|
print("Loading x.tudelft.nl")
|
||||||
driver.get("https://x.tudelft.nl")
|
driver.get("https://x.tudelft.nl")
|
||||||
|
|
||||||
|
print("Done loading x.tudelft.nl")
|
||||||
button = WebDriverWait(driver, 30).until(
|
button = WebDriverWait(driver, 30).until(
|
||||||
EC.element_to_be_clickable(
|
EC.element_to_be_clickable(
|
||||||
(By.XPATH, "//span[contains(text(), 'TUDelft')]")
|
(By.XPATH, "//span[contains(text(), 'TUDelft')]")
|
||||||
@ -76,6 +72,7 @@ class XClient:
|
|||||||
cookie = driver.execute_script(
|
cookie = driver.execute_script(
|
||||||
"return window.localStorage.getItem('delcom_auth');"
|
"return window.localStorage.getItem('delcom_auth');"
|
||||||
)
|
)
|
||||||
|
print(cookie)
|
||||||
|
|
||||||
if cookie is None:
|
if cookie is None:
|
||||||
raise LoginFailedException("Logging in to X has failed")
|
raise LoginFailedException("Logging in to X has failed")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user