0

So this is my first time working with selenium, and I get the chromedriver browser to open fo a quarter of a second and then it closes, even it I give it a webpage to load or I tell it to sleep. It also gives me a SessionNotCreatedException.

Code:

from selenium import webdriver
import time

class TestBot():
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.get('http://www.google.com/')
        time.sleep(5)

Error:

>>> bot = TestBot()

DevTools listening on ws://127.0.0.1:55101/devtools/browser/7029bc33-860f-42b8-8fb5-751cf27f82bc
[16708:17644:0524/045808.952:ERROR:browser_switcher_service.cc(238)] XXX Init()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "test_bot.py", line 6, in __init__
    self.driver = webdriver.Chrome()
  File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Caleb\test_bot\test_bot\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 83

I've tried adding Chromedriver as a path variable and that didn't work. I can start a chromedriver session just fine in cmd.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Are you sure you have tha latest chromedriver? – Giorgos Kavalieratos May 24 '20 at 09:13
  • @GiorgosKavalieratos I am using chromedriver version 83.0.4103.39 along with chrome verion 83.0.4103.61 which supports chrome version 83 – Caleb Foster May 24 '20 at 09:19
  • check this answers https://stackoverflow.com/questions/60296873/sessionnotcreatedexception-message-session-not-created-this-version-of-chrome – Giorgos Kavalieratos May 24 '20 at 09:21
  • Does this answer your question? [SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81](https://stackoverflow.com/questions/60296873/sessionnotcreatedexception-message-session-not-created-this-version-of-chrome) – ashwin vinod May 24 '20 at 09:25

4 Answers4

0

I think you should try running Selenium with MozillaFirefox,you also will need to install Geckodriver, which is a software that acts as a bridge between Firefox and selenium.

Godda
  • 951
  • 1
  • 10
  • 26
0

I was looking at the wrong version of chrome, turns out I have version 81, so I installed webdriver-manager and that works

0

as we see in the last line:

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

try to:

  • update Chrome to last version so selenium too

  • use geckodriver.exe for chrome , and put inside a folder then try:

self.driver = webdriver.Chrome(r"c:\your\geckodriver\path\withput\")
Jawad
  • 186
  • 1
  • 14
0

This error message...

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

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


Analysis

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

  • You are using ChromeDriver 83.0
  • Release Notes of ChromeDriver 83.0 clearly mentions the following :

Supports Chrome version 83

Most possibly the Chrome Browser haven't been updated to Chrome v83.0 yet as a part of the recent push and still is Chrome v81.0

  • Your Selenium Client version is unknown to us.

So there is a clear mismatch between ChromeDriver v83.0 and the Chrome Browser v81.0


Solution

Ensure that:

  • Selenium is upgraded to current levels Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v83.0 level.
  • Chrome is updated to current Chrome Version 83.0 level. (as per ChromeDriver v83.0 release notes)
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352