5

Hey so I have this simple code to open google using selenium

from selenium import webdriver
import chromedriver_binary


driver = webdriver.Chrome()
driver.get('https://google.com')

Instead of opening the google page I get this error.

Traceback (most recent call last):
  File "main.py", line 5, in <module>
    driver = webdriver.Chrome()
  File "C:\Users\vipku\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "C:\Users\vipku\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\vipku\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\vipku\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\vipku\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
alnesef2002
  • 77
  • 1
  • 6

3 Answers3

4

This error message...

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85

...implies that the ChromeDriver v85.0 was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.


Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You mentioned about using chromedriver=85.0.4183.38 and the release notes of chromedriver=85.0.4183.38 clearly mentions the following :

Supports Chrome version 85

  • Presumably you are using current version of Chrome Browser i.e. Version 84.0.4147.135.

So there is a clear mismatch between ChromeDriver v85.0 and the Chrome Browser v84.0


Solution

Ensure that:

  • ChromeDriver is updated to current ChromeDriver v84.0 level.
  • Chrome is updated to current (released) Chrome Version 84.0 level. (as per ChromeDriver v84.0 release notes).
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Reference

You can find a relevant detailed discussion in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
1

Make sure chrome driver installed match chrome version installed on your machine and path of chrome driver is set to your PATH Variable. http://chromedriver.chromium.org/downloads

1

I fixed it by using this code pip install chromedriver-binary==83.0.4103.39

alnesef2002
  • 77
  • 1
  • 6