You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importosfromdotenvimportload_dotenvfromseleniumimportwebdriverfromselenium.webdriver.chrome.serviceimportServicefromselenium.webdriver.common.keysimportKeysload_dotenv()
# default path for homebrew-installed chromedriverCHROMEDRIVER_PATH=os.getenv("CHROMEDRIVER_PATH", default="/usr/local/bin/chromedriver")
CHROME_BINARY_PATH=os.getenv("CHROME_BINARY_PATH") # specify path where chrome binary is installed, as necessary (see "build.sh")HEADLESS_MODE=bool(os.getenv("HEADLESS_MODE", default="false") =="true")
defcreate_driver(headless=HEADLESS_MODE, chromedriver_path=CHROMEDRIVER_PATH, binary_location=CHROME_BINARY_PATH):
options=webdriver.ChromeOptions()
# help Mac find where you installed Chrome# help production server find custom installation of chrome binary (see "build.sh"):ifbinary_location:
# https://github.com/SeleniumHQ/selenium/blob/4071737de47f1cec2dfef934f3e18a2e36db20d5/py/selenium/webdriver/chromium/options.py#L34options.binary_location=binary_locationifheadless:
options.add_argument('--no-sandbox')
options.add_argument('--incognito')
options.add_argument('--headless')
options.add_argument('--disable-dev-shm-usage')
#return webdriver.Chrome(chromedriver_path, options=options)service=Service(executable_path=chromedriver_path)
returnwebdriver.Chrome(service=service, options=options)
The text was updated successfully, but these errors were encountered:
Update for selenium 4.11:
The text was updated successfully, but these errors were encountered: