ScreenshotNeo

BlogHow-to

How to Fix Selenium’s CDP Version Mismatch Warning in Java

Fix Selenium’s Java CDP mismatch warning by aligning Selenium, browser and CDP dependencies, then move supported features to WebDriver BiDi.

By the ScreenshotNeo team1 October 20268 min read

Short answer: Selenium’s CDP version mismatch warning means the Selenium Java classes on your classpath do not have an exact generated Chrome DevTools Protocol implementation for the browser major version you launched. Ordinary WebDriver commands may still work. Update all Selenium Java modules together, verify the resolved dependency tree, and add a specific CDP implementation only when your code needs a protocol domain that the bundled version does not provide. For supported event-driven features, prefer WebDriver BiDi.

The warning is different from a ChromeDriver startup error. Chrome and ChromeDriver must match in major version; CDP modules are Selenium dependencies loaded by your Java application. Fix the two problems separately.

1. What the warning means

Selenium generates Java classes for browser-specific CDP domains. At startup, CdpVersionFinder compares the browser’s CDP major version with the implementations available on your classpath and selects the closest match. If none is available, Selenium can return a no-op CDP implementation. That is why a session can start while a CDP feature later fails or does nothing.

CDP is not designed as a stable testing API and its methods change with browser versions. Selenium’s documentation states: “CDP support is temporary until WebDriver BiDi has been implemented.” See the Selenium CDP documentation and the CdpVersionFinder Java API.

Message or symptom What it usually concerns
Unable to find an exact match for CDP version ... Selenium lacks an exact generated CDP implementation for the browser version.
SessionNotCreatedException mentioning driver/browser ChromeDriver and Chrome major versions are incompatible.
WebDriver navigation works, CDP command fails The selected CDP implementation does not expose the domain or method your code calls.
CDP call silently has no effect A closest-match or no-op implementation may have been selected; inspect the resolved Selenium modules.

2. Diagnose the exact versions first

  1. Record the full Chrome or Chromium version and its major number.
  2. Record the Selenium Java version resolved by Maven or Gradle, not only the version written in a parent property.
  3. If startup fails, record the ChromeDriver major version too.
  4. Look for old transitive Selenium modules or a mixture of Selenium release numbers.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class VersionCheck {
  public static void main(String[] args) {
    WebDriver driver = new ChromeDriver();
    try {
      System.out.println(driver.getCapabilities().getBrowserName());
      System.out.println(driver.getCapabilities().getBrowserVersion());
      System.out.println(driver.getCapabilities().getCapability("chrome"));
    } finally {
      driver.quit();
    }
  }
}

The nested chrome capability commonly contains driver details, but its shape can vary by driver version. Treat the browser version and your build-tool dependency report as the authoritative inputs.

Maven: inspect resolved Selenium modules

mvn dependency:tree -Dincludes=org.seleniumhq.selenium
mvn help:evaluate -Dexpression=selenium.version -q -DforceStdout

Gradle: inspect resolved Selenium modules

./gradlew dependencies --configuration testRuntimeClasspath | grep -i selenium
./gradlew dependencyInsight --dependency selenium-java --configuration testRuntimeClasspath

3. Update Selenium Java consistently

Use one selenium-java release for the project and let its matching modules resolve together. Selenium’s Java installation guide currently shows 4.49.0 as its example. Releases and browser support move, so choose a current version when you apply this fix and verify the result in your own build.

Maven

<properties>
  <selenium.version>4.49.0</selenium.version>
</properties>

<dependencies>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>${selenium.version}</version>
  </dependency>
</dependencies>
mvn -U clean test
mvn dependency:tree -Dincludes=org.seleniumhq.selenium

Gradle

def seleniumVersion = '4.49.0'

dependencies {
    testImplementation "org.seleniumhq.selenium:selenium-java:${seleniumVersion}"
}
./gradlew --refresh-dependencies clean test
./gradlew dependencyInsight --dependency selenium-java --configuration testRuntimeClasspath

Do not upgrade only selenium-devtools-vNNN while leaving the rest of Selenium on another release. Mixed versions can compile and still produce an incomplete or incompatible CDP classpath.

4. Add a specific CDP version only when required

If your test needs a domain from a particular CDP version, Selenium’s Domains API advises depending on that version and using its domains directly. The exact artifact suffix depends on the browser and Selenium release available to your project; do not copy a module name from an old blog post without checking the published artifacts and Java API for your chosen release.

  1. Identify the browser major version and the Selenium release you resolved.
  2. Check which versioned DevTools module is published for that release in Maven Central and in the Selenium DevTools Java API.
  3. Add the matching module at the same Selenium release level as the rest of your dependencies.
  4. Import that module’s generated domains in code, then rerun the dependency tree to confirm there is one coherent version set.

Keep this option for code that truly needs a version-specific CDP domain. If you only need navigation, locators, screenshots or other WebDriver operations, updating selenium-java is usually sufficient.

5. Move supported event features to WebDriver BiDi

For console logs, JavaScript errors and network interception, Selenium’s current guidance points to WebDriver BiDi. BiDi is the standards-based, cross-browser direction, while CDP is Chromium-specific and version-sensitive. Confirm that the operation you need is implemented in your Selenium Java version and supported by the browser before migrating.

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class BidiSession {
  public static void main(String[] args) {
    ChromeOptions options = new ChromeOptions();
    options.setCapability("webSocketUrl", true);

    ChromeDriver driver = new ChromeDriver(options);
    try {
      driver.get("https://example.com");
      // Use the Selenium Java BiDi APIs available in your resolved release
      // for logging, script or network subscriptions.
    } finally {
      driver.quit();
    }
  }
}

Read Selenium’s WebDriver BiDi documentation for the feature-specific Java APIs. Enabling the WebSocket capability alone does not replace a CDP command; your code must use the corresponding BiDi API.

6. Keep ChromeDriver mismatch separate

Selenium’s Chrome guidance requires Chrome and ChromeDriver to match in major version. A driver mismatch prevents session creation; a CDP mismatch usually appears as a warning after Selenium can talk to the browser. Check the Chrome-specific Selenium documentation and your driver manager or container image when startup fails.

  • Update the browser and driver together, or pin both to compatible major versions.
  • Make sure CI uses the same browser image and driver resolution strategy as local development.
  • Do not expect a newer ChromeDriver to add missing CDP Java domains; those domains come from Selenium dependencies.

7. A practical decision checklist

Your situation Action
Warning only; WebDriver tests pass; no CDP calls Update Selenium on a planned schedule and monitor the warning. It may not affect your tests.
CDP command or event fails Align Selenium modules, then use a matching versioned CDP module if the domain is still required.
Need console, JavaScript error or network events Check the BiDi API for your Selenium release and migrate where supported.
Session cannot be created Check Chrome and ChromeDriver major versions independently.
Several Selenium versions appear in dependency output Remove overrides and exclusions that create the mixture; keep one release line.

8. Troubleshooting common errors

“Unable to find an exact match for CDP version”

Cause: the browser major is newer or older than Selenium’s generated implementations. Fix: update selenium-java, confirm the resolved version, and add the intentionally selected versioned module only if your feature requires it.

“You are using a no-op implementation”

Cause: Selenium found no usable generated implementation. Fix: align the browser with a Selenium release that covers it, or remove the CDP dependency from code and use WebDriver BiDi where available.

SessionNotCreatedException: driver only supports Chrome version …

Cause: ChromeDriver and Chrome major versions differ. Fix: install a matching driver or use Selenium Manager with a compatible browser installation; then rerun the CDP diagnosis separately.

ClassNotFoundException or NoSuchMethodError after adding a DevTools module

Cause: mixed Selenium release numbers or duplicate modules. Fix: inspect Maven or Gradle resolution, remove the mismatched override, and keep all Selenium artifacts on one release.

The warning remains after upgrading

Cause: the build is still resolving an older jar, or the browser moved beyond the release’s supported generated implementations. Fix: run a clean build with refreshed dependencies, inspect the runtime classpath, and compare the actual browser major with Selenium’s current CDP coverage.

Can I suppress the log?

You can change logging configuration, but that only hides evidence. It does not add protocol compatibility. Fix the dependency or migrate the feature instead.

9. Reliability, performance and maintenance

  • Pin deliberately: pin Selenium in CI so a browser update cannot silently change the protocol surface; update it as a tested change.
  • Test the feature, not the warning: run a small smoke test for every CDP domain your suite uses. A session starting does not prove every domain works.
  • Keep browser images reproducible: record browser, driver and Selenium versions in build logs.
  • Prefer fewer protocol-specific calls: WebDriver commands are generally less coupled to browser-major changes than CDP domains.
  • Use BiDi for new event-driven code: it reduces Chromium-only coupling when the needed API is available.

10. Or skip the browser setup

If your goal is simply to capture a page image or PDF, you do not need to maintain Chrome, ChromeDriver or Selenium CDP modules. ScreenshotNeo provides a GET screenshot API and an MCP server for AI agents. Cookie and consent banners, newsletter popups and chat widgets are removed before capture; bot checks, blank pages and failed loads are not billed; an MCP server lets Claude, Cursor and other MCP clients take screenshots; 1,000 screenshots each month are free with no card, and paid plans start at $5 for 3,000.

See the ScreenshotNeo API documentation for all options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Create a free ScreenshotNeo account with 1,000 screenshots per month and no card.

11. FAQ

Does this warning always break my Selenium test?

No. Basic WebDriver commands can continue to work. Impact depends on whether your code calls a CDP domain that the selected implementation supports.

Should I downgrade Chrome?

Usually no. First update Selenium and verify the resolved dependencies. Downgrade only when your project deliberately pins an older, known-compatible browser matrix.

Is ChromeDriver part of the CDP fix?

Only for session startup. ChromeDriver major alignment is a separate requirement from Selenium’s Java CDP classes.

When should I use a versioned CDP module?

Use one when a required domain is missing from the bundled implementation and you have confirmed the module matches your Selenium release and browser context.

Is WebDriver BiDi supported in every browser and Selenium feature?

No. Support is evolving. Check the BiDi documentation and the Java API for the exact browser and operation you need.