Skip to content

Commit

Permalink
Shim for Windows vs. Linux compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
stucka committed Dec 23, 2024
1 parent 0a277a0 commit f1d91aa
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions warn/scrapers/va.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,22 @@ def scrape(
logger.debug("Attempting to launch Chrome")
chromeoptionsholder = ChromeOptions()
chrome_install = ChromeDriverManager().install()
folder = os.path.dirname(chrome_install)
chromedriver_path = os.path.join(folder, "chromedriver.exe")
service = ChromeService(chromedriver_path)

# 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}")
driver.get(csv_url)

sleep(25) # Give it plenty of time to evaluate Javascript
sleep(30) # Give it plenty of time to evaluate Javascript

download_dir = os.path.expanduser("~") + "/Downloads"

Expand Down

0 comments on commit f1d91aa

Please sign in to comment.