From 3c97068c40d9ce87d5061b6da0df5e8b583147d8 Mon Sep 17 00:00:00 2001 From: Luca Giannotti Date: Thu, 25 Jul 2024 01:40:45 -0500 Subject: [PATCH] fix: fixed bug with new Chrome update due to license file --- dining_hall_scraper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dining_hall_scraper.py b/dining_hall_scraper.py index 73ef764..8f9e43c 100644 --- a/dining_hall_scraper.py +++ b/dining_hall_scraper.py @@ -5,6 +5,7 @@ from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC +import os @@ -18,7 +19,13 @@ def dining_hall_web_scraper(dining_hall, meal): # chrome_options.add_argument("--disable-dev-shm-usage") # chrome_options.add_argument("window-size=1920x1080") - driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=chrome_options) + driver_path = ChromeDriverManager().install() + if driver_path: + driver_name = os.path.basename(driver_path) + if driver_name != "chromedriver.exe": + driver_path = os.path.join(os.path.dirname(driver_path), "chromedriver.exe") + + driver = webdriver.Chrome(service=ChromeService(driver_path), options=chrome_options) driver.get(url)