12
#Once the zip has finished downloading, extract the folder and copy the path of the chromedriver exe file (should be the #first one), add it to your code like this,

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

url = "somewebsite.com"

service_obj = Service("D:\\Users\\eggman\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe")
driver = webdriver.Chrome(service=service_obj)
driver.get(url)

Returns the error:

selenium.common.exceptions.SessionNotCreatedException: This version of ChromeDriver only supports Chrome version 114. LATEST_RELEASE_115 doesn't exist

I'm guessing to avoid this in the future I can just turn off automatic updates?

I originally used the following code which worked fine

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
eggman
  • 137
  • 1
  • 1
  • 4

6 Answers6

18

For Chrome/chromedriver 116+, the solution is similar to https://stackoverflow.com/a/76731553/7058266, but now you need a minimum selenium version of 4.11.2. Then selenium gets the correct driver for you at runtime.

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

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

For more info on the new Chrome-for-Testing, see https://googlechromelabs.github.io/chrome-for-testing/ (this also includes chromedrivers for testing).

Michael Mintz
  • 9,007
  • 6
  • 31
  • 48
  • That works for me, though I get a warnng: The chromedriver version (115.0.5790.102) detected in PATH at /usr/local/bin/chromedriver might not be compatible with the detected chrome version (116.0.5845.96); currently, chromedriver 116.0.5845.96 is recommended for chrome 116.*, so it is advised to delete the driver in PATH and retry – paul Aug 17 '23 at 03:47
  • If you see a warning, it's because Selenium detected that your driver doesn't match your version of Chrome. Selenium will by default save drivers to `~/.cache/selenium`. If you already have a driver on your PATH, it'll try to use that first. You can remove drivers from your PATH to force Selenium's default driver location. – Michael Mintz Aug 17 '23 at 04:04
  • 1
    This worked. But not before I upgraded selenium: "pip install --upgrade selenium" – NeoRamza Aug 22 '23 at 20:18
  • @MichaelMintz how do you remove the drivers from the path? – Olli Sep 02 '23 at 09:18
  • If there's an existing driver on your path that doesn't match, the warning message tells you where it's located. – Michael Mintz Sep 02 '23 at 15:03
2

For my setup the solution to this was quite simple (only discovered after a lot of research though) thanks to this https://www.youtube.com/watch?v=OlMX0gxyL58.

Even though I am on latest selenium (4.11.2), I still get the error about versions not matching.

I downloaded Chrome 114 from https://googlechromelabs.github.io/chrome-for-testing/ unpacked into my downloads folder then added this code to set binary location

options.binary_location = r"ADD_YOUR_PATH\chrome.exe"
  • 1
    I am looking EVERYWHERE for Chrome 114, but cannot find it. I went to your link and it isn't there either. Can you help me find it? – HoustoneD Aug 24 '23 at 16:33
2

Please use below command to upgrade selenium. It helped me out to get resolve the issue, this version selenium will start recognizing the correct browser version. (Environment: windows10, pycharm, venv)

pip install -U selenium==4.11.2
Sudershan
  • 21
  • 3
1

After installation of selenium v4.11.2, things are working fine, I faced the issue with v4.10

Indrajeet Gour
  • 4,020
  • 5
  • 43
  • 70
0

For users of undetected chromedriver: get the newest version of driver from link in start post, then use driver_executable_path parameter. Also you need update both selenium and undetected_chromedriver libraries.

driver = uc.Chrome(driver_executable_path=r"chromedriver-win64\chromedriver.exe", options=options)

Where folder chromedriver-win64 in script's directory. If you won't write this parameter, program will try automatically get the version, that don't support Chrome 115+

qazya1
  • 1
  • 2
0

Migrating OP's solution from the question to an answer:

I found a solution (in python) and wanted to share, go to the Chrome Labs Testing page and copy the corresponding "URL" for your platform and paste it in to your browser and the download will begin. I selected the version based on the version that my chrome browser automatically updated to which was 116.0.5845.97. You can find this by opening settings in chrome browser and then clicking on "About Chrome".

TylerH
  • 20,799
  • 66
  • 75
  • 101