From 8594d9e40d1b71ebe831fbf384e1272fe694da23 Mon Sep 17 00:00:00 2001 From: Alexei Date: Wed, 2 Aug 2023 14:19:47 -0400 Subject: [PATCH] Don't specify ChromeDriver path unless provided --- crawler.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crawler.py b/crawler.py index 2b375d8..3467ebd 100755 --- a/crawler.py +++ b/crawler.py @@ -53,7 +53,6 @@ CHROME_EXT_ID = 'mcgekeccgjgcmhnhbabplanchdogjcnh' CHROME_URL_PREFIX = 'chrome-extension://' -CHROMEDRIVER_PATH = 'chromedriver' FF_EXT_ID = 'jid1-MnnxcxisBPnSXQ@jetpack' FF_UUID = 'd56a5b99-51b6-4e83-ab23-796216679614' @@ -111,7 +110,7 @@ help='Path to the Privacy Badger source checkout') ap.add_argument('--browser-binary', default=None, help="Path to the browser binary, for example /usr/bin/google-chrome-beta") -ap.add_argument('--chromedriver-path', default=CHROMEDRIVER_PATH, +ap.add_argument('--chromedriver-path', default=None, help="Path to the ChromeDriver binary") ap.add_argument('--firefox-tracking-protection', @@ -447,11 +446,16 @@ def start_driver(self): opts.set_capability("acceptInsecureCerts", False); opts.set_capability("unhandledPromptBehavior", "ignore"); + # TODO Edge-specific settings? disable Tracking Prevention by default? + for _ in range(5): try: if self.browser == CHROME: - service = ChromeService(executable_path=self.chromedriver_path) - self.driver = webdriver.Chrome(options=opts, service=service) + if self.chromedriver_path: + service = ChromeService(executable_path=self.chromedriver_path) + self.driver = webdriver.Chrome(options=opts, service=service) + else: + self.driver = webdriver.Chrome(options=opts) else: self.driver = webdriver.Edge(options=opts) except ConnectionResetError as e: