Scrivio Interview library
DebuggingIntermediate7 min read · updated 12 November 2026

Your Selenium suite suddenly fails on CI with SessionNotCreatedException: This version of ChromeDriver only supports Chrome version N, Current browser version is N+1. Nothing changed in the repository. Explain the cause and make the setup robust.

The repository did not change, but the machine did: the CI image or agent updated Chrome to a new major version while an old, pinned or cached chromedriver stayed behind, and chromedriver refuses to drive a browser of a different major version. The quick fix is to stop pointing at a fixed driver file and let Selenium Manager pick the matching driver; the lasting fix is to make the browser and the driver change together, through pinned container images or a pinned browserVersion, with a cached, offline-capable setup and an early warning job against Chrome beta.

Why this question is asked

A failure that appears with no code change is one of the most confusing things a team can meet on CI, and it usually costs a morning of people blaming each other's commits. Interviewers ask it to see whether we understand that a UI test depends on three moving parts, our code, the browser and the driver, and whether we can make the setup robust. In this answer, we will recap how Selenium talks to Chrome, see exactly why the version check fails, apply the immediate fix, and then make the setup robust with pinned images, driver caching, offline mode and a scheduled run against the next browser version.

1A Quick Recap of Browser, Driver and Selenium

When a Selenium test calls new ChromeDriver(), our Java code does not control Chrome directly. It starts a separate program called chromedriver, a small server built by the Chrome team that speaks the W3C WebDriver protocol over HTTP. Selenium sends it commands, and chromedriver translates them into Chrome's internal automation calls.

Because chromedriver is built against the internals of one Chrome release, each chromedriver major version supports exactly one Chrome major version. chromedriver 130 drives Chrome 130 and nothing else. When a session starts, chromedriver asks the browser for its version, and if the major numbers differ it refuses to create the session. Selenium surfaces that refusal as SessionNotCreatedException, with the message we saw in the question.

So there are three things on the CI machine that must agree: the Selenium client library in our pom.xml, the chromedriver binary, and the installed Chrome. Only the first one lives in our repository.

2Why It Breaks When Nothing Changed

Chrome ships a new major version roughly every four weeks, and most operating system images install it from a package repository that updates automatically. Hosted CI images are rebuilt by their providers with the newest Chrome, and self-hosted agents often run unattended upgrades, so Chrome moves forward on its own schedule.

The driver often does not move with it. Common reasons are a line such as System.setProperty("webdriver.chrome.driver", "/opt/drivers/chromedriver") that points at a file someone downloaded a year ago, a driver checked into the repository, or a driver cached on the agent by an older tool. Notice that when we set that system property, Selenium uses exactly that file and does not try to find a better one. So on Monday the agent has Chrome 130 and chromedriver 130, on Tuesday the image update brings Chrome 131, and every test fails at the first new ChromeDriver() call.

Step throughHow a silent Chrome update breaks the suite
  1. CI image updates Chrome130 -> 131, no commit in our repository
  2. Test calls new ChromeDriver()Selenium starts the driver it was told to use
  3. Is a fixed driver path set?
    YesUse the old chromedriver 130NoSelenium Manager finds driver 131
  4. chromedriver checks Chrome's major version130 driver, 131 browser
  5. Versions match?
    YesSession startsNoSessionNotCreatedException

5 steps in order. Play them, or step through them one at a time.

The failure is in the environment, which is why the git history shows nothing.

3The Immediate Fix: Let Selenium Manager Resolve the Driver

Since Selenium 4.6, the Java bindings include Selenium Manager, a small tool that runs when we create a driver without naming a driver file. It detects the installed browser version, downloads the matching driver if it is not already cached, and hands its path to Selenium. Since Selenium 4.11 it can also download a Chrome for Testing build when no suitable Chrome is installed. So the first fix is mostly a deletion.

Java
// Before: a hard-coded driver that will fall behind the browser
System.setProperty("webdriver.chrome.driver", "/opt/drivers/chromedriver");
WebDriver driver = new ChromeDriver(); // SessionNotCreatedException after Chrome updates
// After: no driver path; Selenium Manager matches the driver to the browser
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new");
WebDriver driver = new ChromeDriver(options); // driver 131 downloaded and cached for Chrome 131

If the environment cannot download anything today, the other quick fix is to update the pinned driver to the new major version. That works, but it only resets the clock until the next Chrome release, so we should treat it as a stopgap.

4Making the Setup Robust: Browser and Driver Change Together

The deeper problem is that a browser update reached our pipeline without anyone reviewing it. The robust setup makes the browser version an explicit, versioned input, just like a library version in the pom, so it only changes when we change it.

The most reliable way is to run the browser in a container. The selenium/standalone-chrome images contain a matching Chrome and chromedriver, built and tested together. If we use a fixed tag that names the release, for example selenium/standalone-chrome:4.27.0-20241204 (check the image's tag list for the exact formats it publishes), the browser cannot change under us. Upgrading becomes a one-line pull request that runs the suite before it merges.

If we run the browser directly on the agent, we can pin the version in the test code instead. Setting browserVersion in the options tells Selenium Manager to fetch that exact Chrome for Testing build and its driver, ignoring whatever Chrome the image happens to have.

Java
ChromeOptions options = new ChromeOptions();
options.setBrowserVersion(System.getProperty("chrome.version", "131")); // pinned, reviewed in the build file
WebDriver driver = new ChromeDriver(options);
// Selenium Manager downloads Chrome for Testing 131 and chromedriver 131 once, then reuses them

Notice that both options turn the browser into something our repository controls. The surprise update becomes a planned update.

5Caching Drivers and Working Offline on CI

Selenium Manager keeps what it downloads in a cache folder, by default under the user's home in .cache/selenium. On CI, each job often starts with an empty home directory, so every job downloads the browser and driver again. So we keep that folder in the CI cache, keyed on the pinned browser version, the same way we cache the Maven repository.

Some build networks block downloads entirely. Selenium Manager supports configuration through environment variables or a config file, including a custom cache path and an offline mode in which it uses only what is already cached and never goes to the network (the variables are named like SE_CACHE_PATH and SE_OFFLINE; check your Selenium version's documentation for the exact names). With offline mode on, a missing driver gives a clear error instead of a hanging download, and a mirror or a prepared image can supply the files.

6An Early Warning Job Against Chrome Beta

Even with pinning, Chrome will keep moving, and each new version can change behaviour our tests rely on. So we add a scheduled pipeline, for example nightly, that runs the suite against the next version. Selenium Manager accepts channel names, so setting browserVersion to beta fetches the current Chrome beta and its driver.

This job does not block merges. Its job is to tell us, two to four weeks before a release reaches our pinned setup, that something will break. When it goes red, we fix things without pressure, and upgrading the pin later is routine.

Java
String channel = System.getenv().getOrDefault("BROWSER_CHANNEL", "131"); // "beta" in the nightly job
ChromeOptions options = new ChromeOptions();
options.setBrowserVersion(channel);
WebDriver driver = new ChromeDriver(options); // nightly: Chrome beta plus matching chromedriver

7Follow-up questions

How do you run the same tests on Firefox and Edge?

We make the browser a parameter rather than a constant. A small factory reads a property such as browser=chrome, firefox or edge and returns a ChromeDriver, FirefoxDriver or EdgeDriver built from ChromeOptions, FirefoxOptions or EdgeOptions. Selenium Manager resolves geckodriver and msedgedriver in the same way it resolves chromedriver, so the version problem is handled for all three. On Grid we create a RemoteWebDriver with the matching options and the Grid routes the session to a node with that browser. The CI pipeline then runs the suite once per browser as a matrix, often Chrome on every commit and Firefox and Edge nightly, with the same pinning rules for each.

Why not just disable Chrome auto-updates on the agent?

That stops the surprise but leaves the browser version as an invisible property of one machine. A new agent or a rebuilt image will have a different version. Pinning in a container tag or in browserVersion records the version in the repository, where it is reviewed and reproducible.

8Conclusion

In this answer, we saw that SessionNotCreatedException with a version message means the browser and the driver disagree on the major version, and that it appears without a commit because the CI environment updated Chrome while a pinned or cached chromedriver stayed behind. We fixed it immediately by removing the hard-coded driver path and letting Selenium Manager match the driver, and we made it robust by pinning browser and driver together in a container image or browserVersion, caching downloads with an offline option, and running a scheduled job against Chrome beta to catch breaks early.

What to say in the interviewAbout 90 seconds aloud

Open with

This error means chromedriver and Chrome disagree on the major version. Each chromedriver release supports exactly one Chrome major, and it refuses to start a session otherwise. Nothing changed in the repository because the change happened in the environment: the CI image or the agent updated Chrome on its own schedule, while the driver was pinned by a hard-coded webdriver.chrome.driver path or cached from an older download.

Then, if they want more

The immediate fix is to delete that system property and let Selenium Manager, which ships with Selenium 4, detect the browser and download the matching driver, or as a stopgap to update the pinned driver. To make it robust, I make the browser version an explicit input that changes only through a reviewed pull request.

On CI I prefer the selenium/standalone-chrome container with a fixed release tag, because browser and driver are built together; without containers I set browserVersion in ChromeOptions so Selenium Manager fetches a specific Chrome for Testing build. I cache the Selenium Manager folder on CI, and where the network is restricted I use its offline mode with a prepared cache.

Finally I add a nightly job that runs with browserVersion set to beta, so we learn about breaking changes weeks before stable Chrome reaches our pin. For Firefox and Edge, I use the same factory with FirefoxOptions or EdgeOptions and run the browsers as a CI matrix.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your Selenium suite suddenly fails on CI with SessionNotCreatedException: This version...": https://scrivio-interview-library.netlify.app/java/ui-testing/17f0c0b628/