Resolving ChromeDriver Version Mismatch in Selenium
Problem Statement
When using Selenium for browser automation, you may encounter a version compatibility error:
selenium.common.exceptions.SessionNotCreatedException:
This version of ChromeDriver only supports Chrome version 114. LATEST_RELEASE_115 doesn't exist
This error occurs when:
- Your Chrome browser version is newer than your ChromeDriver version
ChromeDriverManager
fails to find a compatible driver version- Your Selenium version doesn't support the new Chrome for Testing infrastructure
- Your ChromeDriver path is configured incorrectly
The core issue is a version mismatch between Chrome and ChromeDriver, exacerbated by changes in Google's driver distribution since Chrome 115.
Version Compatibility Critical
Your ChromeDriver version must exactly match your major Chrome browser version (e.g., Chrome 123 requires ChromeDriver 123). Google now distributes versions through the Chrome for Testing project.
Recommended Solutions
1. Update Selenium and Use Auto-Managed ChromeDriver (Best Practice)
Chrome for Testing Support
Since Selenium 4.11.2, the Service()
class can automatically download and manage the correct ChromeDriver version through the Chrome for Testing infrastructure.
First upgrade Selenium:
bashpip install -U selenium==4.11.2 # Or install the latest version pip install -U selenium
Use this simplified code structure:
pythonfrom selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options options = Options() options.add_argument("--headless=new") # Optional: run headless service = Service() # Auto-manages driver version driver = webdriver.Chrome(service=service, options=options) driver.get("https://example.com") # Your automation code here driver.quit()
Key advantages:
- No manual driver downloads
- Automatically handles version matching
- Uses Google's official stable channels
2. Manually Install Correct ChromeDriver Version
When you need explicit version control:
Check your Chrome version:
Visitchrome://settings/help
in browserDownload matching driver from the official source:
https://googlechromelabs.github.io/chrome-for-testing/Configure driver path directly:
pythonfrom selenium import webdriver from selenium.webdriver.chrome.service import Service # Extract downloaded driver to known path chrome_driver_path = "/path/to/chromedriver.exe" # Windows # chrome_driver_path = "/usr/bin/chromedriver" # Linux # chrome_driver_path = "chromedriver_mac64" # macOS service = Service(executable_path=chrome_driver_path) driver = webdriver.Chrome(service=service)
3. Using undetected-chromedriver
(For Bypassing Detection)
When automating undetected browsers:
import undetected_chromedriver as uc
# Must use explicit path to downloaded driver
driver = uc.Chrome(
driver_executable_path=r"path/to/chromedriver",
version_main=115, # Manually specify major version if needed
options=options
)
Ensure you have the latest package:
pip install -U undetected-chromedriver
Common Errors and Fixes
Incorrect Driver Path Specification
Path Configuration
Specify the executable file, not just its directory:
❌ Incorrect:
service = Service("C:/drivers/chromedriver-win64/")
✅ Correct:
service = Service("C:/drivers/chromedriver-win64/chromedriver.exe")
Persisting Browser/Driver Mismatch
Force specific browser version if necessary:
options = Options()
options.binary_location = r"C:/chrome-for-testing/chrome.exe"
Best Practices to Prevent Issues
Use explicit version pinning in CI/CD:
bash# Install specific Chrome version wget https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.122/linux64/chrome-linux64.zip
Avoid disabling browser updates: Instead manage through:
- The Chrome for Testing project
- Docker containers with fixed versions
Implement compatibility checks:
pythonfrom selenium import __version__ as selenium_version print(f"Selenium: {selenium_version}") # Should be ≥4.11.2
Deprecated Methods
Avoid outdated executable_path
parameter:
# DEPRECATED - DO NOT USE
driver = webdriver.Chrome(executable_path="chromedriver.exe")
Summary Recommendation
For most users: Update to Selenium 4.11.2+ and use Service()
without arguments. This automatically resolves ~90% of versioning issues. Reserve manual driver management for special cases requiring explicit version control.
The Chrome for Testing project (https://googlechromelabs.github.io/chrome-for-testing/) should be your authoritative source for browser/driver binaries.