|
|
@ -61,7 +61,7 @@ class WebDriver: |
|
|
|
log_fname = globvars.user_profile.webdriver_log_fname |
|
|
|
log_fname = globvars.user_profile.webdriver_log_fname |
|
|
|
if "chromedriver" in webdriver_path: |
|
|
|
if "chromedriver" in webdriver_path: |
|
|
|
options = webdriver.ChromeOptions() |
|
|
|
options = webdriver.ChromeOptions() |
|
|
|
options.headless = True |
|
|
|
options.add_argument( "--headless" ) |
|
|
|
options.add_argument( "--no-sandbox" ) # nb: need this on the rPi 4 |
|
|
|
options.add_argument( "--no-sandbox" ) # nb: need this on the rPi 4 |
|
|
|
options.add_argument( "--no-proxy-server" ) |
|
|
|
options.add_argument( "--no-proxy-server" ) |
|
|
|
# OMG! The chromedriver looks for Chrome/Chromium in a hard-coded, fixed location (the default |
|
|
|
# OMG! The chromedriver looks for Chrome/Chromium in a hard-coded, fixed location (the default |
|
|
@ -70,23 +70,23 @@ class WebDriver: |
|
|
|
if chrome_path: |
|
|
|
if chrome_path: |
|
|
|
options.binary_location = chrome_path |
|
|
|
options.binary_location = chrome_path |
|
|
|
service = webdriver.chrome.service.Service( |
|
|
|
service = webdriver.chrome.service.Service( |
|
|
|
webdriver_path, log_path=log_fname |
|
|
|
webdriver_path, log_output=log_fname |
|
|
|
) |
|
|
|
) |
|
|
|
if is_windows(): |
|
|
|
if is_windows(): |
|
|
|
service.creationflags = 0x8000000 # win32process.CREATE_NO_WINDOW |
|
|
|
service.creation_flags = 0x8000000 # win32process.CREATE_NO_WINDOW |
|
|
|
self.driver = webdriver.Chrome( |
|
|
|
self.driver = webdriver.Chrome( |
|
|
|
options=options, service=service |
|
|
|
options=options, service=service |
|
|
|
) |
|
|
|
) |
|
|
|
elif "geckodriver" in webdriver_path: |
|
|
|
elif "geckodriver" in webdriver_path: |
|
|
|
options = webdriver.FirefoxOptions() |
|
|
|
options = webdriver.FirefoxOptions() |
|
|
|
options.headless = True |
|
|
|
options.add_argument( "--headless" ) |
|
|
|
service = webdriver.firefox.service.Service( |
|
|
|
service = webdriver.firefox.service.Service( |
|
|
|
webdriver_path, log_path=log_fname |
|
|
|
webdriver_path, log_output=log_fname |
|
|
|
) |
|
|
|
) |
|
|
|
if is_windows(): |
|
|
|
if is_windows(): |
|
|
|
service.creationflags = 0x8000000 # win32process.CREATE_NO_WINDOW |
|
|
|
service.creation_flags = 0x8000000 # win32process.CREATE_NO_WINDOW |
|
|
|
self.driver = webdriver.Firefox( |
|
|
|
self.driver = webdriver.Firefox( |
|
|
|
options=options, proxy=None, service=service |
|
|
|
options=options, service=service |
|
|
|
) |
|
|
|
) |
|
|
|
else: |
|
|
|
else: |
|
|
|
raise SimpleError( "Can't identify webdriver: {}".format( webdriver_path ) ) |
|
|
|
raise SimpleError( "Can't identify webdriver: {}".format( webdriver_path ) ) |
|
|
|