Reputation: 169
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.
Upvotes: 11
Views: 92247
Reputation: 4631
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 127
Current browser version is 132.0.6834.111
Try this way:
from undetected_chromedriver import Chrome
driver = Chrome(version_main=132)
and remove:
driver = webdriver.Chrome()
Upvotes: 0
Reputation: 71
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
Upvotes: 0
Reputation: 143
Running brew reinstall --cask chromedriver
should suffice.
This resolved the issue on an apple m1 macbook, in case that's helpful.
Upvotes: 2
Reputation: 12304
For mac:
116.0.5845.96
brew uninstall --cask chromedriver
/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 .
Upvotes: 2
Reputation: 169
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.
Upvotes: 1
Reputation: 61
As of September 2022, the following solution worked for me on an M1 Macbook.
brew uninstall --cask chromedriver
brew install --cask chromedriver
Upvotes: 6
Reputation: 1
I had the same problem, to fix it you need to verify if your Google Chrome version is updated.
And run again your test
Upvotes: 0
Reputation: 1571
You should see your version on your chrome navigator and use the same. Help/ About and see the version.
Upvotes: 0
Reputation: 31
go to https://chromedriver.chromium.org/ and download the latest stable version of chromedriver and download it in your project folder.
Upvotes: 3
Reputation: 11
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:
Go to manage nuGet packages..
then go to browse tab and search the package with keyword: "Selenium.Chrome.WebDriver" (For other browser, install corresponding package)
and then install it. (Note: if it is already installed then remove the package before installing it.)
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");)
Upvotes: 1