Skip to content

Commit

Permalink
Don't specify ChromeDriver path unless provided
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed Aug 2, 2023
1 parent efd6e83 commit 8594d9e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8594d9e

Please sign in to comment.