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