seleniumgoogle-chromeselenium-webdrivertesting

Selenium - This version of ChromeDriver only supports Chrome version xx


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.


Solution

  • 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.