Selenium - This version of ChromeDriver only supports Chrome version xx
Asked Answered
W

9

9

Suddenly today all my tests stopped working, giving me following error message:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 97 Current browser version is 99.0.4844.51 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

I have not updated the browser (auto-update is disabled) before the error occurred, i haven't changed anything at all. I have now downloaded Version 99.0.4844.51 of both the browser as well as driver but I still get the very same error. I've tried every solution i could find on here and the internet (although most were just "update your stuff") but nothing has worked.

Wheatworm answered 4/3, 2022 at 10:45 Comment(5)
Note: This is a workaround and not the exact solution to your problem: Install webdriver manager: 'pip install webdriver-manager import: from webdriver_manager.chrome import ChromeDriverManager. Then instead of your local chromedriver path, use this: driver = webdriver.Chrome(ChromeDriverManager().install()) this should work. Basically, it takes care of version compatibilities between driver and browser versionsTriturate
I've tried this and while it works on my work station it doesn't run on the server but i will tinker around with it further, thanks.Wheatworm
Selenium has an official manager in the works selenium.dev/blog/2022/introducing-selenium-managerFlagellant
That's awesome! This will save me so much work once it's released.Wheatworm
Related question & answers here #62155965Biflagellate
W
1

while many answers here are correct, they cannot easily be automated.

Here's what I did:

a) Anand Gautams solution does work under certain circumstances: f.e. local and manual use of tests. I use webdriver-manager in those cases and it works well. If Anand had posted an Answer instead of a comment, i would mark that as a Solution as it partially is.

However:

b) In stage and production and when automated on a company server having a program download things is generally a bad idea. Yes you can whitelist the source but for a multitude of security reasons (from technical to legal) you shouldn't. My solution for this was a rather daunting one: I made a collection of all reasonable webdriver versions for all the supported browsers (which is being expanded regularly since clients have a completely different definition of "reasonable") and made a module that checks for installed browsers and their versions and pairs them with the corresponding webdriver version (for local usage) or enables you to manually choose a version to test with (for test automation on a server).

b1) I'm not sure if I'm allowed to post the module here publicly, i will ask and edit the answer should this be the case.

b2) While this solution enables you to automate support for a great bandwidth of browsers and versions within a closed system it is very tedious and maintaining it can be work intensive at times. I would definitely try to avoid this solution if possible.

For now I will mark this answer as a solution. I hope somebody comes up with something better in the future.

Wheatworm answered 23/3, 2023 at 10:20 Comment(0)
P
6

As of September 2022, the following solution worked for me on an M1 Macbook.

  • Uninstall the Chrome browser
  • Then uninstall chromedriver brew uninstall --cask chromedriver
  • Re-install the Chrome browser
  • Then re-install the chromedriver brew install --cask chromedriver
Palpable answered 21/9, 2022 at 13:39 Comment(2)
brew reinstall --cask chromedriverSubak
$ brew upgrade --cask chromedriver worked for me. Have an MBP M1 Max running Sonoma 14.5Lothair
F
3

go to https://chromedriver.chromium.org/ and download the latest stable version of chromedriver and download it in your project folder.

Fernandes answered 9/3, 2022 at 9:8 Comment(1)
Sorry for the semi-offtopic comment, but does anybody else find it incredibly frustrating that on their Downloads page they do not provide the download links, and that the only place to actually download the binaries is the the googlechromelabs, which they say only hosts the experimental releases!?! I don't understand why this choice of presentation, but I find it outrageous. Anyway, here is the link if anyone is wondering. googlechromelabs.github.io/chrome-for-testingVolkslied
A
2

Running brew reinstall --cask chromedriver should suffice. This resolved the issue on an apple m1 macbook, in case that's helpful.

Assay answered 1/8, 2023 at 22:5 Comment(0)
I
1

I had the same issue, chromedriver stays linked for old version of chromedriver even if new version was updated. Try to use instructions below, for me it was helpful:

  1. Go to manage nuGet packages..

  2. then go to browse tab and search the package with keyword: "Selenium.Chrome.WebDriver" (For other browser, install corresponding package)

  3. and then install it. (Note: if it is already installed then remove the package before installing it.)

  4. update your chrome driver from here: http://chromedriver.chromium.org/downloads and save it to your local machine and give the path of it into your code.(var driver = new ChromeDriver(@"C:\Libraries");)

Indore answered 8/3, 2022 at 11:20 Comment(0)
W
1

while many answers here are correct, they cannot easily be automated.

Here's what I did:

a) Anand Gautams solution does work under certain circumstances: f.e. local and manual use of tests. I use webdriver-manager in those cases and it works well. If Anand had posted an Answer instead of a comment, i would mark that as a Solution as it partially is.

However:

b) In stage and production and when automated on a company server having a program download things is generally a bad idea. Yes you can whitelist the source but for a multitude of security reasons (from technical to legal) you shouldn't. My solution for this was a rather daunting one: I made a collection of all reasonable webdriver versions for all the supported browsers (which is being expanded regularly since clients have a completely different definition of "reasonable") and made a module that checks for installed browsers and their versions and pairs them with the corresponding webdriver version (for local usage) or enables you to manually choose a version to test with (for test automation on a server).

b1) I'm not sure if I'm allowed to post the module here publicly, i will ask and edit the answer should this be the case.

b2) While this solution enables you to automate support for a great bandwidth of browsers and versions within a closed system it is very tedious and maintaining it can be work intensive at times. I would definitely try to avoid this solution if possible.

For now I will mark this answer as a solution. I hope somebody comes up with something better in the future.

Wheatworm answered 23/3, 2023 at 10:20 Comment(0)
H
0

You should see your version on your chrome navigator and use the same. Help/ About and see the version.

Hon answered 8/6, 2022 at 2:17 Comment(0)
D
0

I had the same problem, to fix it you need to verify if your Google Chrome version is updated.

  1. Open Google Chrome and go to settings [image1]: https://i.sstatic.net/GzOzy.png
  2. Verify your Google Chrome version [image2] https://i.sstatic.net/o2Vmn.png
  3. Update your chrome version [image3]: https://i.sstatic.net/dsZNd.png

And run again your test

Distributive answered 31/8, 2022 at 18:41 Comment(1)
while this may generally help it's not a solution for when older versions of chrome need to be tested as well. i have multiple versions of chrome and the according versions of the chromedriver. right now i'm using the webdriver_manager that Anand mentioned but ideally i would prefer to match the versions manually which still doesn't work until today.Wheatworm
R
0

For mac:

  1. Go to Chrome Browser > Help > About and check out what's the version. Mine was: 116.0.5845.96

enter image description here

  1. Download stable Chromedriver depending on version from:
  1. Uninstall existing chromedriver by calling command in terminal:
brew uninstall --cask chromedriver
  1. Unzip downloaded chromedriver and move to /usr/local/bin/
mv chromedriver /usr/local/bin/    

Now it should be working fine i.e. in PyCharm.

p.s. macOS might mention that chromedriver comes from unknow source. You need to run it once manually by right click on this chromedriver and select open. My way is to open this folder from terminal:

cd /usr/local/bin/ && open .

enter image description here

Rubric answered 21/8, 2023 at 17:53 Comment(0)
B
0

If you just need a single version you can download it using the Chrome puppeteer/browsers command-line utility via npm (see https://developer.chrome.com/blog/chrome-for-testing/):

# Download the latest available Chrome for Testing binary corresponding to the Stable channel.
npx @puppeteer/browsers install chrome@stable

# Download a specific Chrome for Testing version.
npx @puppeteer/browsers install [email protected]

# Download the latest available ChromeDriver version corresponding to the Canary channel.
npx @puppeteer/browsers install chromedriver@canary

# Download a specific ChromeDriver version.
npx @puppeteer/browsers install [email protected]

Once you have the binary you need you can add it (or the command to get it) to your build process and specify the path to the binary as part of your selenium config. See ChromeDriver Capabilities

Boreas answered 1/2 at 14:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.