3

This error drives me crazy. My code is:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import chromedriver_binary
from selenium.webdriver.common.by import By
import time
from influxdb import InfluxDBClient
chrome_options = Options()
chrome_options.add_argument("--headless")
chromedriver_binary = 
"/home/dario/scripts/cron_run/web_app_login_checker/chromedriver/chromedriver"
driver = webdriver.Chrome(chromedriver_binary, options=chrome_options)

If I do:

 ./chromedriver -v
 ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch- 
 heads/3945@{#614})

It's the right version.

Full traceback is:

    Traceback (most recent call last):
    File "grafana.py", line 12, in <module>
    driver = webdriver.Chrome(chromedriver_binary, options=chrome_options)
    File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
    packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
    File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
   packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
   self.start_session(capabilities, browser_profile)
   File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
   packages/selenium/webdriver/remote/webdriver.py", line 252, in 
   start_session
   response = self.execute(Command.NEW_SESSION, parameters)
   File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
   packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   self.error_handler.check_response(response)
   File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/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 
   79

None of the already discussed topics here on Stack Overflow helped me.

Guy
  • 46,488
  • 10
  • 44
  • 88
newduino
  • 179
  • 1
  • 6
  • 16

4 Answers4

6

The problem is the Chrome browser version, not the ChromeDriver version. You need to update it to version 79, or downgrade the ChromeDriver. You can find here the matching versions.

Guy
  • 46,488
  • 10
  • 44
  • 88
  • Matching the driver to browser version is easier now that they match – bitsand Dec 26 '19 at 21:27
  • 2
    I ran `which chromedriver` to determine where the binary should go. – jmunsch Jan 06 '20 at 18:27
  • How would I ever know what version is running where? Everything these days is updated automatically. My TFS build server has one version of Chrome, my dev box has another; our production servers a third version entirely. Because of obvious reasons, we dont keep everything up to date. That would be wrong. But Of course we update our development environments all the time. – Christian May 07 '20 at 13:47
1

If you are getting this error when you run stuffs on automated cluster and you are downloading the stable version of the google chrome every time then you can use the below shell script to download the compatible version of the chrome driver dynamically every time even if the stable version of the chrome gets updated. You could do something similar to this python to make it work.

%sh
#downloading compatible chrome driver version
#getting the current chrome browser version
**chromeVersion=$(google-chrome --product-version)**
#getting the major version value from the full version
**chromeMajorVersion=${chromeVersion%%.*}**
# setting the base url for getting the release url for the chrome driver
**baseDriverLatestReleaseURL=https://chromedriver.storage.googleapis.com/LATEST_RELEASE_**
#creating the latest release driver url based on the major version of the chrome
**latestDriverReleaseURL=$baseDriverLatestReleaseURL$chromeMajorVersion**
**echo $latestDriverReleaseURL**
#file name of the file that gets downloaded which would contain the full version of the chrome driver to download
**latestDriverVersionFileName="LATEST_RELEASE_"$chromeMajorVersion**
#downloading the file that would contain the full release version compatible with the major release of the chrome browser version
**wget $latestDriverReleaseURL** 
#reading the file to get the version of the chrome driver that we should download
**latestFullDriverVersion=$(cat $latestDriverVersionFileName)**
**echo $latestFullDriverVersion**
#creating the final URL by passing the compatible version of the chrome driver that we should download
**finalURL="https://chromedriver.storage.googleapis.com/"$latestFullDriverVersion"/chromedriver_linux64.zip"**
**echo $finalURL**
**wget $finalURL**

I was able to get the compatible version of chrome browser and chrome driver using the above approach when running scheduled job on the databricks environment and it worked like a charm without any issues.

Hope it helps others in one way or other.

Nikunj Kakadiya
  • 2,689
  • 2
  • 20
  • 35
1
  1. Check your chrome version How to check the chrome browser version

    1. Download the same version of the chrome driver Check the latest driver here

    2. Update your driver in the reference folder.

In my case, I am using the windows 10 and python I've updated with the latest chromedriver.exe file (for Chrome v83) I've backup old driver and keep the latest driver for the version support for the chrome version

ptsivakumar
  • 437
  • 6
  • 4
0

This error message...

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

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

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

Supports Chrome version 79

  • Presumably you are using the latest Version 78.0.3904.108 (Official Build)

ChromeVersion 78.0.3904.108

So there is a clear mismatch between the ChromeDriver v79.0.3945.36 and Chrome Browser v78.0.3904.108


Solution

There are two possible solutions:

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