diff --git a/browserdriver/__init__.py b/browserdriver/__init__.py index 6607943..27b7d56 100755 --- a/browserdriver/__init__.py +++ b/browserdriver/__init__.py @@ -4,6 +4,7 @@ import platform from selenium import webdriver 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.service import Service as EdgeService from selenium.webdriver.firefox.options import Options as FirefoxOptions @@ -24,11 +25,15 @@ class BrowserDriver: def chrome(headless=True): + chrome_path = os.path.join(CWD, 'chrome-linux64', 'chrome') + driver_path = os.path.join(CWD, 'driver', 'chromedriver') options = ChromeOptions() + options.binary_location = chrome_path if headless: options.add_argument("--headless") 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):