The Error
org.openqa.selenium.SessionNotCreatedException:
session not created: This version of ChromeDriver only supports Chrome version 120
Current browser version is 131.0.6778.86
The error is unusually honest: your driver speaks version 120; your browser speaks 131.
Why This Happens
ChromeDriver is a translator between Selenium and Chrome. Each ChromeDriver build understands one specific Chrome version's protocol.
The problem: Chrome auto-updates silently, roughly every 4 weeks. Your pinned ChromeDriver doesn't. So a suite that passed on Friday fails on Monday, with no code change — which is why this error feels so unfair.
The Permanent Fix: Stop Managing Drivers ⭐
Most guides tell you to download the matching driver. That's the treadmill, not the fix — you'll be back in 4 weeks.
Selenium 4.6+ — do nothing (best)
Selenium Manager is built in. It detects your Chrome version and fetches the right driver automatically.
// That's it. No driver path, no WebDriverManager, no download.
WebDriver driver = new ChromeDriver();
If you're on Selenium 4.6 or later and still setting webdriver.chrome.driver, delete that line. Leftover manual paths override Selenium Manager and cause exactly this error.
// ❌ Delete this — it's why Selenium Manager isn't helping you
System.setProperty("webdriver.chrome.driver", "C:/drivers/chromedriver.exe");
Upgrade to a current Selenium:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.27.0</version>
</dependency>
Selenium < 4.6 — use WebDriverManager
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.9.2</version>
<scope>test</scope>
</dependency>
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
Fixing It in CI ⭐
CI is where this bites hardest, because the agent's Chrome updates without telling you.
The real fix: pin both, in a container.
# docker-compose — Chrome and driver ship together, versioned
services:
chrome:
image: selenium/standalone-chrome:4.27.0
Now the version pair is locked and reproducible. Your build doesn't break because a machine somewhere updated.
In a Jenkinsfile:
stage('Test') {
agent { docker { image 'selenium/standalone-chrome:4.27.0' } }
steps { sh 'mvn clean test' }
}
If you can't use Docker: disable Chrome auto-update on the agent, or run Selenium Manager (4.6+) so the driver follows the browser automatically.
The Manual Fix (When You Must)
Check your Chrome version: chrome://version (or Help → About)
Download the matching driver: Chrome for Testing dashboard — the modern source; the old chromedriver.chromium.org downloads stop at v114.
Match the major version — driver 131.x works with Chrome 131.x.
⚠️ This is a patch, not a fix. You'll repeat it every ~4 weeks. Use Selenium Manager or Docker instead.
Other Causes of SessionNotCreated
It isn't always a version mismatch:
| Message | Cause | Fix |
|---|---|---|
only supports Chrome version X |
Version mismatch ⭐ | Selenium Manager / WebDriverManager |
Chrome failed to start: crashed |
No sandbox in Docker | --no-sandbox --disable-dev-shm-usage |
cannot find Chrome binary |
Chrome not installed / non-standard path | Install it, or set options.setBinary() |
DevToolsActivePort file doesn't exist |
Container resource limits | --no-sandbox --disable-dev-shm-usage |
probably user data directory is already in use |
Stale Chrome processes | Kill leftovers; unique --user-data-dir per run |
The Docker essentials — these three prevent most container failures:
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--headless=new");
The Interview Answer
"SessionNotCreatedException with a version message means ChromeDriver and Chrome are incompatible — usually because Chrome auto-updated and the pinned driver didn't. The fix isn't downloading a new driver each time; that's a treadmill. From Selenium 4.6, Selenium Manager resolves the driver automatically, so I remove any hardcoded driver path. In CI I pin browser and driver together in a Docker image, so builds are reproducible and don't break when an agent updates."
FAQs
What causes SessionNotCreatedException?
Usually a ChromeDriver/Chrome version mismatch — Chrome auto-updated, the driver didn't. It can also mean Chrome crashed on startup or isn't installed.
What's the permanent fix?
Selenium 4.6+ has Selenium Manager built in — it resolves the correct driver automatically. Remove any System.setProperty("webdriver.chrome.driver", ...) lines, which override it.
Why does it break every few weeks?
Chrome auto-updates roughly monthly. A pinned driver goes stale silently — your code didn't change, the browser did.
How do I stop it in CI?
Pin Chrome and driver together in a Docker image (e.g., selenium/standalone-chrome:4.27.0) so the pair is locked and reproducible.
I get "Chrome failed to start: crashed" in Docker.
Not a version issue — add --no-sandbox and --disable-dev-shm-usage.
Related
- Selenium Fundamentals — how WebDriver talks to browsers
- Test Passes Locally, Fails in Jenkins — other CI-only failures
- Complete Jenkins Guide — CI setup
- Maven & CI/CD