Selenium ChromeDriverManager doesn't downloads the latest version of ChromeDriver
D

6

8

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.

Deferral answered 30/1, 2023 at 7:47 Comment(1)
one week ago this code was working fine. This error starts coming from Friday(27Jan2023).Deferral
D
1

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.

Deferral answered 30/1, 2023 at 17:16 Comment(1)
Mark this answer as a solution please.Ahlers
P
3

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)

Plunkett answered 22/7, 2023 at 7:42 Comment(0)
W
3

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.

Wolff answered 1/8, 2023 at 14:25 Comment(0)
M
2

Try using:

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

resource

Memoried answered 30/1, 2023 at 8:0 Comment(3)
this code does not work, It gives the below error- raise ValueError(f"There is no such driver by url {resp.url}") ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/109.0.5414.120/chromedriver_win32.zip Process finished with exit code 1Deferral
Just updated my answer, does it now work?Memoried
you have a shortage of double quote =)) thanks for your solution, it is helpfulPlunkett
A
2

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
Anima answered 7/8, 2023 at 4:49 Comment(0)
D
1

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.

Deferral answered 30/1, 2023 at 17:16 Comment(1)
Mark this answer as a solution please.Ahlers
P
0

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

Paraesthesia answered 13/9, 2023 at 9:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.