Switch to firefox

This commit is contained in:
Yigit Colakoglu 2024-09-30 15:10:09 +02:00
parent 00f3bc4ffd
commit 10fb02c90d
3 changed files with 5 additions and 10 deletions

View File

@ -19,7 +19,7 @@ RUN apt-get update && \
build-essential \
libsqlite3-dev \
sqlite3 \
chromium \
firefox \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

View File

@ -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"

View File

@ -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")