Selenium ChromeDriverManager doesn't downloads the latest version of ChromeDriver

8k Views Asked by At

I have an error:

E       selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 102
E       Current browser version is 109.0.5414.120 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

I have already used the code to get latest version of webdriver-

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("--allow-running-insecure-content")
options.add_argument("--ignore-certificate-errors")
options.set_capability("acceptInsecureCerts", True)

        preferences = {"profile.default_content_settings.popups": 0,
                       "download.default_directory": r""+Constants.path+"",
                       # IMPORTANT - ENDING SLASH V IMPORTANT
                       "directory_upgrade": True}
options.add_experimental_option("prefs", preferences)

driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), options=options)

With this same code I am able to run this code on my local machine(i.e. laptop) but this code is not working on my Virtual machine. the chrome version on both machine is same i.e. - 109.0.5414.120.

Please guide.

6

There are 6 best solutions below

1
AnilD On BEST ANSWER

On my virtual machine, I found that there are two different versions(one latest and one older version) of chrome installed at two different locations. Therefore I uninstalled both chrome and deleted all chrome/google associated folders and files then install a fresh version of the google chrome browser. Finally, the code runs successfully.

3
kaliiiiiiiii On

Try using:

driver = webdriver.Chrome(executable_path=ChromeDriverManager(version="109.0.5414.74").install(), options=options)

resource

0
lam vu Nguyen On

your problem is as below: this ChromeDriverManager().install() will get LATEST chromedriver version -in my case today, it is 115.0.5790- at

https://chromedriver.storage.googleapis.com/

but on their site LATEST chromedriver version has not been ready to be installed

update: it seems more exact, you can view ChromeDriver only supports Chrome version 114 Current browser version is 116.0.5845.111 - (Selenium version - 3.141.59)

this is not error of code, it is one of library or because of chrome's changing

-> LATEST chromedriver version has not been ready to be installed

solution is, as @kaliiiiiiiii said, driver = webdriver.Chrome(executable_path=ChromeDriverManager(version="114.0.5735.16").install(), options=options)

0
semmyk-research On

While the answers here are correct, however, for future readers, there are notable changes.

  1. ChromeDriverManager() is no longer required in Selenium version v4.6.0 and greater.
    See Selenium documentation: As of Selenium 4.6, Selenium downloads the correct driver for you. You shouldn’t need to do anything..
  2. In Selenium manager 4.10.0 (released 07 Jun '23), the executable_path was removed.
    However, one can still pass in an executable_path, using the service arg:
    service=Service(executable_path='path_to_chromedriver')
    This is not recommended.

Readers should refer to answers from this SO.

PS: Selenium manager 4.11.0 is now released: 31 Jul '23.

0
Jim C On

In addition to the answers suggested by others, simply upgrading your selenium webdriver-manager to the latest version may also help - at least in some cases.

pip install webdriver-manager --upgrade
0
Pascal Louis-Marie On

That worked for me using latest version 117
It unblocked me from this error message : "ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_117.0.5938"
All the pushed changes:
installed seleniumbase as replacement for legacy selenium :
--> pip install seleniumbase
upgraded wrapper :
--> pip install --upgrade pyhtml2pdf
upgraded webdriver-manager :
--> pip install webdriver-manager --upgrade
updated the code
from :
from selenium import webdriver
driver = webdriver.Chrome(...)
To:
from seleniumbase import Driver
driver = Driver(browser="chrome", headless=False)

#more info about new selenium 4.11 options available -> https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/driver_manager.py