From 35b3d148edc4556390057d90bd791eeab0712e47 Mon Sep 17 00:00:00 2001 From: Mike Stucka Date: Tue, 24 Dec 2024 12:23:43 -0500 Subject: [PATCH] Try to use Github Actions' chromedriver --- warn/scrapers/va.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/warn/scrapers/va.py b/warn/scrapers/va.py index 71c5604..e737140 100644 --- a/warn/scrapers/va.py +++ b/warn/scrapers/va.py @@ -116,17 +116,17 @@ def scrape( chromeoptionsholder.add_argument("--remote-debugging-pipe") chromeoptionsholder.add_argument("--verbose") - chrome_install = ChromeDriverManager().install() - - # Weird error with finding the driver name in Windows. Sometimes. - if chrome_install.endswith("THIRD_PARTY_NOTICES.chromedriver"): - chrome_install = chrome_install.replace( - "THIRD_PARTY_NOTICES.chromedriver", "chromedriver.exe" - ) + if "CHROMEWEBDRIVER" in os.environ: + chrome_install = os.environ["CHROMEWEBDRIVER"] + else: + chrome_install = ChromeDriverManager().install() + + # Weird error with finding the driver name in Windows. Sometimes. + if chrome_install.endswith("THIRD_PARTY_NOTICES.chromedriver"): + chrome_install = chrome_install.replace( + "THIRD_PARTY_NOTICES.chromedriver", "chromedriver.exe" + ) logger.debug(f"Chrome install variable is {chrome_install}") - # folder = os.path.dirname(chrome_install) - # chromedriver_path = folder # os.path.join(folder, "chromedriver.exe") - # service = ChromeService(chromedriver_path) service = ChromeService(chrome_install) driver = webdriver.Chrome(options=chromeoptionsholder, service=service) logger.debug(f"Attempting to fetch {csv_url}")