2

I use selenium in my python project. Few days ago program worked correctly but today I ran my script and it caused this warning. Script:

from selenium import webdriver
import chromedriver_autoinstaller


chromedriver_autoinstaller.install()
options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications": 1}

options.add_argument('--ignore-certificate-errors')
options.add_argument('--ignore-ssl-errors')

options.add_experimental_option("prefs", prefs)
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)
driver = webdriver.Chrome(options=options)
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
driver.execute_cdp_cmd("Network.setUserAgentOverride", {"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"})

I tried reinstall chromedriver but it didn't help

Egor
  • 23
  • 4

3 Answers3

4

Selenium Manager is now fully included with selenium 4.10.0, so this is all you need:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service()
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
# ...
driver.quit()

If the driver isn't found on your system PATH, Selenium Manager will automatically download it.


If you're wondering why you're now seeing this error, it's because https://chromedriver.chromium.org/downloads only goes up to version 114 due to driver restructuring by the Chromium Team for the new Chrome-for-Testing.

Michael Mintz
  • 9,007
  • 6
  • 31
  • 48
0

chrome updated their way of communicating stable versions pretty recently and most tools still need to receive their updates.

I propose you look here https://github.com/SergeyPirogov/webdriver_manager for managing the webdriver in python. This package is mentioned on the official chromedriver site. It implements the new way of communicating the versions but there is still an issue with chromedriver for chrome 115.0.5790.110 as we speak.

maybe follow the open or closed issues in that repo

also have a look at this answer https://stackoverflow.com/a/76752843/2559785

studioj
  • 1,300
  • 17
  • 32
0

This is a recent issue you may use the chromedriver by downloading locally or updating the chromedriver-autoinstaller==0.6.2

I downloaded 115 successfully using version 0.6.2 on Win32. please use the latest version using:

pip install chromedriver-autoinstaller==0.6.2
MD Kawsar
  • 313
  • 2
  • 12