fix the binary pathing for chrome
This commit is contained in:
parent
2a3722b585
commit
5866721964
@ -4,6 +4,7 @@ import platform
|
|||||||
|
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.chrome.options import Options as ChromeOptions
|
from selenium.webdriver.chrome.options import Options as ChromeOptions
|
||||||
|
from selenium.webdriver.chrome.service import Service as ChromeService
|
||||||
from selenium.webdriver.edge.options import Options as EdgeOptions
|
from selenium.webdriver.edge.options import Options as EdgeOptions
|
||||||
from selenium.webdriver.edge.service import Service as EdgeService
|
from selenium.webdriver.edge.service import Service as EdgeService
|
||||||
from selenium.webdriver.firefox.options import Options as FirefoxOptions
|
from selenium.webdriver.firefox.options import Options as FirefoxOptions
|
||||||
@ -24,11 +25,15 @@ class BrowserDriver:
|
|||||||
|
|
||||||
|
|
||||||
def chrome(headless=True):
|
def chrome(headless=True):
|
||||||
|
chrome_path = os.path.join(CWD, 'chrome-linux64', 'chrome')
|
||||||
|
driver_path = os.path.join(CWD, 'driver', 'chromedriver')
|
||||||
options = ChromeOptions()
|
options = ChromeOptions()
|
||||||
|
options.binary_location = chrome_path
|
||||||
if headless:
|
if headless:
|
||||||
options.add_argument("--headless")
|
options.add_argument("--headless")
|
||||||
options.add_argument('--ignore-certificate-errors')
|
options.add_argument('--ignore-certificate-errors')
|
||||||
return webdriver.Chrome(options=options)
|
chrome_service = ChromeService(executable_path=driver_path)
|
||||||
|
return webdriver.Chrome(service=chrome_service, options=options)
|
||||||
|
|
||||||
|
|
||||||
def firefox(headless=True):
|
def firefox(headless=True):
|
||||||
|
Loading…
Reference in New Issue
Block a user