Skip to main content
SeleniumDecoded
Chapter 8 · Lesson 6 of 6 Debugging & Best Practices
On this page

Upgrading Selenium Safely

Keep Selenium current without breaking CI: read release notes, act on deprecations, automate with Renovate or Dependabot, run canaries, and pin browsers.

Selenium 4 Stable 10 min read · Updated · Verified against Selenium 4.52.0

Many teams treat their Selenium version like a foundation: poured once, never touched. The result is a suite pinned to a client that is a year or more behind the browsers it drives. Browsers update every few weeks, and Chrome moved to a two-week release cadence in 2026. Each browser release can change protocol behaviour, timing, and default features. An old client keeps working right up until it does not, and when it fails it rarely announces itself as “your Selenium is too old”. It shows up as flakiness.

In August 2026 the Selenium project published a public service announcement making exactly this point: keep your Selenium client updated, review it at least quarterly, and recognise that outdated clients cause failures that look like test bugs. This lesson is a practical playbook for doing that without turning every upgrade into a fire drill.

Why Staying Current Matters

Risk of staying behindWhat it looks like
Protocol driftCommands that worked start failing intermittently on new browser versions
Missed bug fixesYou spend days debugging an issue fixed three releases ago
Removed APIs pile upOne giant upgrade later instead of several small ones
Security fixesTLS validation and trust-store updates (4.52 updated Selenium Manager’s certificate validation and trust roots) never reach you
Language runtime supportNew Python, Java or .NET versions are supported only by newer clients (4.51 added Python 3.15)
Grid compatibilityMixed client and Grid versions behave inconsistently

The cost of upgrading grows faster than linearly with the gap. Moving from 4.51 to 4.52 is usually a version bump. Moving from 4.20 to 4.52 means working through dozens of release notes, several removals, and a few behaviour changes at once, with no way to tell which one broke which test.

What Changes Between Releases

In 2026 Selenium has released every two to three weeks, with each release covering all bindings plus Grid and Selenium Manager. Knowing the categories of change helps you scan release notes quickly:

  • Removals of deprecated APIs. Announced through deprecation warnings first. Examples from 2026: 4.50 removed deprecated Firefox profile extension and certificate methods from all bindings; 4.49 removed the old Java se/files download endpoint.
  • Dependency changes. 4.51 removed Guava from the Java client entirely, which is a worked example below.
  • New features. Usually additive and safe: BiDi modules, new Options helpers, new Grid features.
  • Behaviour changes. Rarer and usually flagged clearly: 4.52 made Python cookie domain and path matching follow RFC 6265.
  • Minimum runtime changes. Current minimums are Java 11, Python 3.10, .NET 8 or netstandard2.0, and the current Node LTS.

Track releases on the selenium.dev blog, in the GitHub releases for SeleniumHQ/selenium, and in each binding’s changelog. Our releases page summarises the highlights per version.

Reading Release Notes Efficiently

You do not need to read every line. For each release between your current and target versions:

  1. Search for “removed” and “deprecated” in your binding’s changelog. Removals are the only changes that break compilation.
  2. Search for the APIs you actually use. Grep your codebase for the class or method names mentioned.
  3. Check “minimum version” and runtime notes. Make sure your CI runtime is still supported.
  4. Note behaviour changes for features your suite depends on (cookies, downloads, waits, Grid).
  5. Check Grid notes if you run your own Grid. Keep the Grid and client on the same minor version where you can.

Tip: Keep a short UPGRADING.md (or a section in your test framework’s README) where you record anything notable from each upgrade: “4.51: replaced Guava Function in WaitHelpers.java”. It turns the next upgrade from archaeology into a checklist.

Treat Deprecation Warnings as Work Items

Deprecations are the advance notice of removals. Make them visible and, ideally, fail the build on them in a dedicated job.

LanguageHow deprecations surfaceMake them loud
Java@Deprecated compiler warningsjavac -Xlint:deprecation; -Werror in a strict CI job
PythonDeprecationWarning at runtimepytest -W error::DeprecationWarning or filterwarnings = error::DeprecationWarning
JavaScriptConsole warnings at runtime; JSDoc @deprecated in editorsLint with a deprecation rule; scan test logs
C#[Obsolete] compiler warning CS0618<WarningsAsErrors>CS0618</WarningsAsErrors> in the test project

For Python, scope the filter to Selenium so third-party noise does not block you:

pytest.ini
[pytest]
filterwarnings =
error::DeprecationWarning:selenium.*

An example from 4.52: Python’s websocket_interval setting was deprecated. A suite running with the filter above fails immediately and points at the exact line, months before the removal lands.

Automating Updates

Manual upgrades get postponed. A bot that opens a pull request for every Selenium release, with your full suite running against it, turns upgrading into code review. Renovate and Dependabot both support all the package ecosystems Selenium ships in.

BindingEcosystemPackage names
JavaMaven / Gradleorg.seleniumhq.selenium:selenium-java (and other org.seleniumhq.selenium artifacts)
Pythonpip / Poetry / uvselenium
JavaScriptnpm / pnpm / Yarnselenium-webdriver
C#NuGetSelenium.WebDriver, Selenium.Support

Group all Selenium artifacts into one pull request. Upgrading selenium-java without selenium-support (or Selenium.WebDriver without Selenium.Support) produces mismatched versions and confusing errors.

Dependabot

.github/dependabot.yml
version: 2
updates:
- package-ecosystem: "maven" # use "gradle" for Gradle builds
directory: "/"
schedule:
interval: "weekly"
groups:
selenium:
patterns:
- "org.seleniumhq.selenium*"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
groups:
selenium:
patterns:
- "selenium"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
groups:
selenium:
patterns:
- "selenium-webdriver"
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"
groups:
selenium:
patterns:
- "Selenium.*"

Keep only the ecosystems your repository uses. A weekly schedule is a good default: Selenium releases every few weeks, so you typically get one pull request per release.

Renovate

{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"packageRules": [
{
"description": "Group all Selenium client packages across ecosystems",
"matchPackageNames": [
"/^org\\.seleniumhq\\.selenium:/",
"selenium",
"selenium-webdriver",
"/^Selenium\\./"
],
"groupName": "selenium",
"schedule": ["before 6am on monday"],
"minimumReleaseAge": "3 days",
"labels": ["dependencies", "selenium"]
}
]
}

Renovate detects Maven, Gradle, pip/Poetry/uv, npm and NuGet files automatically. minimumReleaseAge waits a few days after a release before proposing it, which lets any quick patch release land first. Avoid automerging Selenium updates into a protected branch until you trust your canary pipeline (next section); a green suite on an upgrade PR is the review you want.

Note: Selenium uses MAJOR.MINOR.PATCH versioning, but minor releases can still remove previously deprecated APIs. Do not configure bots to treat Selenium minor versions as “safe to automerge” the way you might for a library with strict semver guarantees.

Canary Pipelines

An upgrade PR tests the next Selenium version against today’s browsers. You also want early warning about tomorrow’s browsers against today’s Selenium. A canary pipeline runs your suite on a schedule against the newest versions of everything:

  • Latest Selenium client (or the open upgrade PR’s branch).
  • Browser channels beta (and optionally dev), which Selenium Manager can download.
  • Latest Grid images, if you run a Grid.
.github/workflows/canary.yml
name: canary
on:
schedule:
- cron: "0 3 * * *" # nightly
workflow_dispatch:
jobs:
canary:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser-version: [stable, beta]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
- name: Run suite against browser channel
run: mvn -B test -Dbrowser.version=${{ matrix.browser-version }}
env:
SE_AVOID_STATS: "true"

Your driver setup reads browser.version and passes it to the Options object. Canary failures are information, not blockers: they tell you that the next Chrome release will break something, two weeks before it reaches stable.

Pinning Browser Versions

Floating “whatever Chrome is installed” is the opposite problem to an outdated client: the browser changes underneath you on its own schedule. For deterministic CI, pin the browser version explicitly, and move the pin deliberately (ideally through the same upgrade-PR process).

Selenium Manager makes this straightforward. Set browserVersion in Options and, if that version is not installed, Selenium Manager downloads the matching Chrome for Testing build (or Firefox, or Edge) and its driver into its cache.

Pin a browser version through Options
Selenium 4 Stable
ChromeOptions options = new ChromeOptions();
options.setBrowserVersion(System.getProperty("browser.version", "142")); // or "stable", "beta"
WebDriver driver = new ChromeDriver(options);
options = webdriver.ChromeOptions()
options.browser_version = os.getenv("BROWSER_VERSION", "142") # or "stable", "beta"
driver = webdriver.Chrome(options=options)
const options = new chrome.Options()
.setBrowserVersion(process.env.BROWSER_VERSION || '142'); // or 'stable', 'beta'
const driver = await new Builder().forBrowser('chrome').setChromeOptions(options).build();
var options = new ChromeOptions
{
BrowserVersion = Environment.GetEnvironmentVariable("BROWSER_VERSION") ?? "142" // or "stable", "beta"
};
var driver = new ChromeDriver(options);

The version numbers above are placeholders; pick the major version your team has validated. You can also pre-download browsers in a CI setup step with the Selenium Manager CLI, so test jobs do not each download them:

Terminal window
# Resolve (and download if needed) Chrome for Testing 142 plus its chromedriver
selenium-manager --browser chrome --browser-version 142
# Use a channel instead of a number
selenium-manager --browser chrome --browser-version beta

The Selenium Manager binary ships inside each binding’s package; the Selenium Manager lesson shows where to find it and how to configure its cache directory. For Docker-based execution, pin the Grid or standalone image tag instead (images are available on Docker Hub and mirrored to ghcr.io/seleniumhq), and bump the tag through your dependency bot; both Renovate and Dependabot can update Docker image tags.

Warning: Do not pin the browser and then forget about it. A browser pinned for a year is as risky as a Selenium client pinned for a year: you are testing in a browser your users no longer have. Move the pin at least monthly, ideally automatically.

Worked Example: The Java 4.51 Guava Removal

Selenium 4.51 removed the Java client’s dependency on Google Guava. As part of that, ExpectedCondition<T> now extends only java.util.function.Function<WebDriver, T>. Previously it also extended Guava’s com.google.common.base.Function. Most code does not notice: passing conditions to wait.until(...) and writing lambdas work unchanged. Two kinds of code break.

Breakage 1: code typed as Guava’s Function

Helpers written years ago, often copied from old blog posts, declare conditions using Guava types:

import com.google.common.base.Function; // Guava
import org.openqa.selenium.support.ui.ExpectedConditions;
public class WaitHelpers {
// Compiled before 4.51 because ExpectedCondition also implemented Guava's Function.
// Fails to compile on 4.51+: incompatible types.
public static Function<WebDriver, WebElement> visible(By locator) {
return ExpectedConditions.visibilityOfElementLocated(locator);
}
}

Breakage 2: relying on Guava transitively

Many test projects used Guava classes (ImmutableList, Lists.newArrayList, Preconditions, Stopwatch) without declaring Guava as a dependency, because Selenium pulled it in. After upgrading, those imports no longer resolve.

Step 1: find affected code

Search the test codebase before bumping the version:

Terminal window
# Direct use of Guava's Function or Predicate (the usual culprits in wait helpers)
grep -rn "com.google.common.base.Function" src/
grep -rn "com.google.common.base.Predicate" src/
# Any Guava usage at all, to find transitive-dependency reliance
grep -rln "com.google.common" src/

On Windows without a POSIX shell, use your IDE’s “Find in Files” or PowerShell: Get-ChildItem -Recurse src | Select-String "com.google.common".

Step 2: switch to java.util.function

Replace the Guava import with the JDK interface. Because ExpectedCondition already extends java.util.function.Function, the body usually stays identical.

import java.util.function.Function; // JDK
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
public class WaitHelpers {
public static Function<WebDriver, WebElement> visible(By locator) {
return ExpectedConditions.visibilityOfElementLocated(locator);
}
// Even better: return the Selenium type, which keeps toString() for clear timeout messages
public static ExpectedCondition<WebElement> visibleCondition(By locator) {
return ExpectedConditions.visibilityOfElementLocated(locator);
}
}

Guava’s Predicate<T> used with old FluentWait code maps to java.util.function.Function<T, Boolean> (FluentWait’s until takes a Function), or simply a lambda returning a boolean.

Step 3: decide about other Guava usage

For the transitive case, you have two options:

  • Declare Guava explicitly in your pom.xml or build.gradle if you genuinely want it. This is a one-line fix and perfectly reasonable.
  • Replace it with JDK equivalents, which have covered most common uses since Java 9-11: List.of, Map.of, Objects.requireNonNull, Duration and Instant for timing.

Step 4: verify

Compile, run the full suite, and run your strict deprecation job. Because this change is compile-time, a successful build is strong evidence the migration is complete; the remaining risk is reflection-based or dynamically loaded helper code, which the grep in step 1 catches.

This is a good template for any upgrade: read the note, grep for the affected API, apply the mechanical fix, and let the compiler and suite confirm it.

An Upgrade Checklist

  1. Read release notes for every version between current and target; search for “removed”, “deprecated” and your key APIs.
  2. Bump all Selenium artifacts together, plus Grid images if you run Grid.
  3. Run the strict deprecation job and fix new warnings.
  4. Run the full suite on the upgrade branch, ideally across your supported browsers.
  5. Compare failure patterns with your main branch: new failures are upgrade-related until proven otherwise.
  6. Merge, then watch flakiness metrics for a few days.
  7. Record anything notable in your upgrade notes.

If something does break and you cannot fix it quickly, roll back the version, open an issue on the Selenium tracker with a minimal reproduction, and keep the upgrade PR open. Staying one release behind for a week is fine; drifting a year behind is the problem.

Common Pitfalls

SymptomCauseFix
“Random” failures after a browser auto-updateOld client against a new browserUpgrade regularly; pin and move browser versions deliberately
Compile errors on com.google.common after 4.51Guava no longer transitiveSwitch to java.util.function or declare Guava
Mismatched Selenium artifactsPartial upgradeGroup packages in Renovate/Dependabot
Upgrade PRs ignored for monthsNo ownershipAssign a rotation; schedule a quarterly review at minimum
Removal surprisesDeprecation warnings hiddenFail a CI job on deprecations
Different behaviour locally and in CIDifferent browser versionsPin browserVersion everywhere
SessionNotCreatedException after a browser updateDriver/browser mismatch from a manually managed driverLet Selenium Manager resolve drivers

Summary

  • Outdated Selenium clients cause failures that look like flaky tests; review versions at least quarterly, as the Selenium project recommends.
  • Read release notes for removals and deprecations, and make deprecation warnings fail a CI job.
  • Automate upgrade PRs with Renovate or Dependabot, grouping all Selenium packages together.
  • Run a canary pipeline against beta browsers for early warning.
  • Pin browsers with browserVersion and Selenium Manager (Chrome for Testing), and move the pin regularly.
  • Migrate mechanically: read the note, grep, fix, let the compiler and suite confirm, as with the 4.51 Guava removal.

Finished this lesson?

Mark it complete to track your progress through the course. Saved in this browser only.

Test yourself Debugging & Flaky Tests 10 questions · advanced

Related lessons