CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-seleniumhq-selenium--selenium-devtools-v138

Chrome DevTools Protocol (CDP) bindings for Selenium WebDriver version 138

Pending
Overview
Eval results
Files

version-system.mddocs/

Version System

Service registration for automatic CDP version discovery and integration with Selenium's version selection mechanism. Handles the automatic detection and initialization of Chrome DevTools Protocol version 138 support.

Capabilities

CDP Version Registration

Registers the v138 implementation with Selenium's service discovery system.

/**
 * CDP version registration service for automatic discovery
 * Annotated with @AutoService for Java ServiceLoader integration
 */
@AutoService(CdpInfo.class)
public class v138CdpInfo extends CdpInfo {
    public v138CdpInfo();
}

Usage Note:

This class is typically not used directly by application code. It is automatically discovered and instantiated by Selenium's CdpVersionFinder when determining the appropriate CDP version for a given Chrome browser version.

Automatic Version Selection

The v138CdpInfo class registers version 138 support with the domains factory:

public v138CdpInfo() {
    super(138, v138Domains::new);
}

This constructor:

  • Registers support for CDP version 138
  • Provides a factory method (v138Domains::new) for creating domain instances
  • Enables automatic selection when Chrome version 138 is detected

Version Selection Process

Selenium automatically selects the appropriate CDP version through this process:

  1. Browser Version Detection: When a Chrome/Chromium browser is launched, Selenium detects its version
  2. Service Discovery: The CdpVersionFinder uses Java ServiceLoader to discover all available CdpInfo implementations
  3. Version Matching: The finder selects the CDP version that best matches the browser version (within a tolerance range)
  4. Domain Factory Creation: The selected CdpInfo provides the domain factory for creating CDP bindings

Browser Version Compatibility

CDP version 138 is designed to work with:

  • Primary target: Chrome/Chromium version 138.x
  • Compatibility range: Chrome versions 133-143 (within 5-version tolerance)
  • Fallback behavior: May work with adjacent versions but with potential feature limitations

Integration Example

While you typically don't instantiate v138CdpInfo directly, here's how the automatic selection works:

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

// Chrome version 138 is automatically detected
ChromeOptions options = new ChromeOptions();
ChromeDriver driver = new ChromeDriver(options);

// DevTools automatically selects v138 implementation
DevTools devTools = driver.getDevTools();
devTools.createSession();

// The domains object is automatically a v138Domains instance
// if Chrome version 138 is running
var domains = devTools.getDomains(); // Returns v138Domains for Chrome 138

devTools.close();
driver.quit();

Manual Version Verification

You can verify which CDP version is being used:

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.CdpVersionFinder;

ChromeDriver driver = new ChromeDriver();

// Get browser version
String browserVersion = driver.getCapabilities().getBrowserVersion();
System.out.println("Browser version: " + browserVersion);

// Get selected CDP version (requires access to internal APIs)
DevTools devTools = driver.getDevTools();
devTools.createSession();

// Check if v138 is being used by examining domain types
var domains = devTools.getDomains();
System.out.println("Domain implementation: " + domains.getClass().getSimpleName());

devTools.close();
driver.quit();

Service Loader Configuration

The @AutoService(CdpInfo.class) annotation automatically generates the required service loader configuration file:

META-INF/services/org.openqa.selenium.devtools.CdpInfo

This file contains:

org.openqa.selenium.devtools.v138.v138CdpInfo

This enables the Java ServiceLoader mechanism to discover the v138 implementation at runtime.

Multiple Version Support

Selenium typically includes multiple CDP versions simultaneously:

  • v137: For Chrome 137 and compatible versions
  • v138: For Chrome 138 and compatible versions
  • v139: For Chrome 139 and compatible versions

The CdpVersionFinder automatically selects the best match based on the detected browser version, providing forward and backward compatibility within reasonable bounds.

Types

// Base CDP information class
abstract class CdpInfo {
    protected CdpInfo(int version, Function<DevTools, Domains> domainFactory);
    public abstract int getVersion();
    public abstract Function<DevTools, Domains> getDomainFactory();
}

// Service discovery annotation
@interface AutoService {
    Class<?>[] value();  // Service interface classes
}

// Domain factory function type
@FunctionalInterface
interface Function<DevTools, Domains> {
    Domains apply(DevTools devtools);
}

Install with Tessl CLI

npx tessl i tessl/maven-org-seleniumhq-selenium--selenium-devtools-v138

docs

console-logging.md

domain-management.md

index.md

javascript-integration.md

network-operations.md

runtime-events.md

target-management.md

version-system.md

tile.json