2

I am getting the following error:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114 Current browser version is 116.0.5845.97 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

Can anyone help me? I've seen some suggestions in other posts but none worked here. I am aware of the Selenium v4.6 update

My code:

from selenium import webdriver
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By




class ChromeAuto:
    def __init__(self):
        self.options = webdriver.ChromeOptions()
        self.options.add_experimental_option('excludeSwitches', ['enable-logging'])
        self.service = Service()
        self.chrome = webdriver.Chrome(service=self.service, options=self.options)
        self.chrome.implicitly_wait(20)
Raptor
  • 53,206
  • 45
  • 230
  • 366
  • Does this answer your question? [selenium.common.exceptions.SessionNotCreatedException: This version of ChromeDriver only supports Chrome version 114. LATEST\_RELEASE\_115 doesn't exist](https://stackoverflow.com/questions/76913935/selenium-common-exceptions-sessionnotcreatedexception-this-version-of-chromedri) – Gugu72 Aug 23 '23 at 12:26

3 Answers3

5

For Chrome 116+ you'll need selenium 4.11.2 at a minimum for the Selenium Manager to download chromedriver 116+ from https://googlechromelabs.github.io/chrome-for-testing/

Then you'll be able to run basic Selenium scripts like this:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service()
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])

driver = webdriver.Chrome(service=service, options=options)
# Add your code here
driver.quit()
Michael Mintz
  • 9,007
  • 6
  • 31
  • 48
  • Every time chrome updates will I have to update selenium? Do I transform the codes into exe and distribute them to customers, in this case is there any way to make this update automatic? @MichaelMintz – Gabriel Passos Aug 18 '23 at 12:12
  • It's hopefully a one-time thing for https://googlechromelabs.github.io/chrome-for-testing/ - Upgrade to `selenium` `4.11.2` and then things should work. – Michael Mintz Aug 18 '23 at 12:31
0

I have had this issue happen to me a few times and my fix was to add the actual chromedriver.exe file into the same folder as the python file. If your python file is inside of a self-made folder, for example, a folder named "test" in your downloads folder then add the chromedriver.exe file into that "test" folder. If your python file is not inside of a subfolder and you are still getting this issue then try updating selenium.

Vanden
  • 3
  • 2
0

Its adapted code (thanks chatgpt) from Michael Mintz for MacOS.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

# Specify the path to chromedriver
chromedriver_path = '/Users/altblog/Downloads/chromedriver-mac-x64/chromedriver'

# Create a WebDriver instance with options
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])

# Create a Service instance for chromedriver
service = Service(chromedriver_path)

# Create a WebDriver instance using the service and options
driver = webdriver.Chrome(service=service, options=options)

# Your code here

# Close the browser
driver.quit()
altblog
  • 15
  • 1
  • 4
  • You don't need to specify the path of ChromeDriver, the corresponding version of ChromeDriver will be downloaded and used automatically. See the accepted answer. – Raptor Aug 22 '23 at 06:36
  • @Raptor Really? https://i.stack.imgur.com/gi8a3.png – altblog Aug 24 '23 at 19:00
  • Seems you have network problem connecting to the download server of ChomeDriver. – Raptor Aug 28 '23 at 01:35