session not created this version of chromedriver only supports chrome version 115

You will see this error whenever a change in Google Chrome or Selenium / Chrome Driver versions (incompatibility between Chrome and ChromeDriver).

Error getting version of chromedriver 116. Retrying with chromedriver 115 (attempt 1/5)
Error getting version of chromedriver 115. Retrying with chromedriver 114 (attempt 2/5)
Traceback (most recent call last):
  File "C:\webdriver_script.py", line 59, in <module>
    start_testing()
  File "C:\webdriver_script.py", line 19, in start_testing
    driver = webdriver.Chrome(options=driver_options) 
  File "C:\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 49, in __init__
    super().__init__(
  File "C:\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 54, in __init__
    super().__init__(
  File "C:\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 206, in __init__
    self.start_session(capabilities)
  File "C:\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 291, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
  File "C:\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 346, in execute
    self.error_handler.check_response(response)
  File "C:\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
..
from session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.96
Stacktrace:
Backtrace:

For me, Google Chrome updated today (August 15), and I started getting this error.

Google Chrome Release: https://chromereleases.googleblog.com/2023/08/dev-channel-update-for-chromeos_15.html

The solution to – this version of ChromeDriver only supports Chrome version

You can make this compatibility issue solved its own by using ChromeDriverManager. Here are the steps.

Step #1 Install ChromeDriverManager

pip install webdriver-manager

Step #2 Import web driver-manager

Import ChromeDriverManager and modify your Python code to use the web driver manager.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))

If you are using ChromeOptions:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager

driver_options = webdriver.ChromeOptions()
# ooptions ...

#  driver = webdriver.Chrome(options=driver_options)
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=driver_options)

This works perfectly fine on Selenium 4.10.0 version.

To check your Selenium version, you can run the below oneliner.

python -c "import selenium; print(selenium.__version__)"

For other versions of Selenium, please refer to this guide:

https://github.com/SergeyPirogov/webdriver_manager