or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

console-logging.mddomain-management.mdindex.mdjavascript-execution.mdnetwork-operations.mdruntime-events.mdtarget-management.md
tile.json

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

Java bindings for Chrome DevTools Protocol version 102, providing programmatic access to Chrome browser debugging and automation capabilities

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.seleniumhq.selenium/selenium-devtools-v102@4.4.x

To install, run

npx @tessl/cli install tessl/maven-org-seleniumhq-selenium--selenium-devtools-v102@4.4.0

index.mddocs/

Selenium DevTools v102

Java bindings for Chrome DevTools Protocol (CDP) version 102, providing programmatic access to Chrome browser debugging and automation capabilities through the DevTools API. This package enables advanced browser automation scenarios beyond standard WebDriver capabilities, including network interception, JavaScript execution, console monitoring, and target management.

Package Information

  • Package Name: selenium-devtools-v102
  • Package Type: Maven
  • Language: Java
  • Installation:
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-devtools-v102</artifactId>
    <version>4.4.0</version>
</dependency>

For Gradle:

implementation 'org.seleniumhq.selenium:selenium-devtools-v102:4.4.0'

Core Imports

import org.openqa.selenium.devtools.v102.V102Domains;
import org.openqa.selenium.devtools.v102.V102CdpInfo;
import org.openqa.selenium.devtools.DevTools;

Basic Usage

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.v102.V102Domains;

// Create ChromeDriver and get DevTools connection
ChromeDriver driver = new ChromeDriver();
DevTools devTools = driver.getDevTools();
devTools.createSession();

// Create V102 domains instance
V102Domains domains = new V102Domains(devTools);

// Enable different domains as needed
domains.network().enableNetworkCaching();
domains.events().enable();
domains.javascript().enable();

// Use the domains for various operations
// ... perform DevTools operations ...

// Cleanup
domains.disableAll();
driver.quit();

Architecture

The selenium-devtools-v102 package is built around several key components:

  • V102Domains: Main entry point providing access to all CDP domain implementations
  • Domain Wrappers: High-level Java interfaces (V102Network, V102Events, etc.) that wrap low-level CDP protocol operations
  • CDP Info Provider: Version-specific information and factory for creating domain instances
  • Generated Protocol Classes: Auto-generated Java classes from Chrome DevTools Protocol definitions (runtime-generated)
  • Idealized Interfaces: Abstract interfaces providing version-agnostic API surface

This design enables type-safe interaction with Chrome's debugging capabilities while abstracting CDP version-specific details.

Capabilities

Domain Management

Core functionality for managing CDP domains and creating the main entry point for all DevTools operations.

/**
 * Main entry point providing access to all CDP domain implementations
 */
public class V102Domains implements Domains {
    public V102Domains(DevTools devtools);
    public Events<?, ?> events();
    public Javascript<?, ?> javascript();
    public Network<?, ?> network();
    public Target target();
    public Log log();
    public void disableAll();
}

/**
 * CDP version information provider for v102
 */
public class V102CdpInfo extends CdpInfo {
    public V102CdpInfo();
}

Domain Management

Runtime Events and Console Handling

Handles runtime events like console API calls, JavaScript exceptions, and provides conversion utilities for Selenium's event system.

public class V102Events extends Events<ConsoleAPICalled, ExceptionThrown> {
    public V102Events(DevTools devtools);
    protected Command<Void> enableRuntime();
    protected Command<Void> disableRuntime();
    protected Event<ConsoleAPICalled> consoleEvent();
    protected Event<ExceptionThrown> exceptionThrownEvent();
}

Runtime Events

JavaScript Execution and Binding

Manages JavaScript execution, binding operations, and script injection for new documents.

public class V102Javascript extends Javascript<ScriptIdentifier, BindingCalled> {
    public V102Javascript(DevTools devtools);
    protected Command<Void> enableRuntime();
    protected Command<Void> enablePage();
    protected Command<Void> doAddJsBinding(String scriptName);
    protected Command<ScriptIdentifier> addScriptToEvaluateOnNewDocument(String script);
}

JavaScript Execution

Network Operations and Interception

Handles network operations, request/response interception, authentication, and user agent management.

public class V102Network extends Network<AuthRequired, RequestPaused> {
    public V102Network(DevTools devTools);
    protected Command<Void> setUserAgentOverride(UserAgent userAgent);
    protected Command<Void> enableNetworkCaching();
    protected Command<Void> enableFetchForAllPatterns();
    protected Event<AuthRequired> authRequiredEvent();
    protected Event<RequestPaused> requestPausedEvent();
}

Network Operations

Console Log Management

Manages console log operations, log entries, and provides conversion between CDP log formats and Selenium's logging system.

public class V102Log implements org.openqa.selenium.devtools.idealized.log.Log {
    public Command<Void> enable();
    public Command<Void> clear();
    public Event<org.openqa.selenium.devtools.idealized.log.model.LogEntry> entryAdded();
}

Console Logging

Target Management

Manages browser targets (tabs, windows, workers), attachment/detachment operations, and target information retrieval.

public class V102Target implements org.openqa.selenium.devtools.idealized.target.Target {
    public Command<Void> detachFromTarget(Optional<SessionID> sessionId, Optional<TargetID> targetId);
    public Command<List<org.openqa.selenium.devtools.idealized.target.model.TargetInfo>> getTargets();
    public Command<SessionID> attachToTarget(TargetID targetId);
    public Command<Void> setAutoAttach();
}

Target Management

Types

Core types used across the API:

// DevTools connection and command types
class DevTools { ... }
class Command<T> { ... }
class Event<T> { ... }

// User agent configuration
class UserAgent {
    String userAgent();
    String acceptLanguage();
    String platform();
}

// Authentication credentials
class UsernameAndPassword {
    String username();
    String password();
}

// HTTP request/response types
class HttpRequest { ... }
class HttpResponse { ... }

// Either type for handling different response types
class Either<L, R> { ... }

// Target and session identifiers
class TargetID {
    TargetID(String id);
    String toString();
}

class SessionID {
    SessionID(String id);
    String toString();
}