or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

domain-management.mdindex.mdjavascript-integration.mdlogging-operations.mdnetwork-operations.mdruntime-events.mdtarget-management.md
tile.json

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

Chrome DevTools Protocol version 115 bindings for Selenium Java WebDriver enabling programmatic browser debugging capabilities

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

To install, run

npx @tessl/cli install tessl/maven-org-seleniumhq-selenium--selenium-devtools-v115@4.13.0

index.mddocs/

Selenium DevTools v115

Selenium DevTools v115 provides Java bindings for Chrome DevTools Protocol version 115, enabling programmatic access to Chrome browser debugging capabilities within Selenium WebDriver. It offers automated code generation from CDP protocol specifications to create type-safe Java APIs for browser automation, network monitoring, JavaScript execution, logging, and event handling.

Package Information

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

Core Imports

import org.openqa.selenium.devtools.v115.v115Domains;
import org.openqa.selenium.devtools.DevTools;

Common for working with specific domains:

import org.openqa.selenium.devtools.v115.v115Events;
import org.openqa.selenium.devtools.v115.v115Javascript;
import org.openqa.selenium.devtools.v115.v115Network;
import org.openqa.selenium.devtools.v115.v115Target;
import org.openqa.selenium.devtools.v115.v115Log;

Basic Usage

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.v115.v115Domains;

// Initialize WebDriver with DevTools support
ChromeDriver driver = new ChromeDriver();
DevTools devTools = driver.getDevTools();
devTools.createSession();

// Create domains instance
v115Domains domains = new v115Domains(devTools);

// Listen to console events
domains.events().addConsoleListener(event -> {
    System.out.println("Console: " + event.getType() + " - " + event.getMessages());
});

// Add JavaScript binding
domains.javascript().addJsBinding("myCallback");

// Set user agent
domains.network().setUserAgent("Custom User Agent v1.0");

// Navigate and interact
driver.get("https://example.com");

driver.quit();

Architecture

Selenium DevTools v115 is built around several key architectural layers:

  • Idealized Interface Layer: Version-independent abstractions (Domains, Events, Javascript, Network, Target, Log) that provide a stable API across different CDP versions
  • v115 Implementation Classes: Version-specific implementations (v115Domains, v115Events, etc.) that adapt CDP v115 to the idealized interfaces
  • Generated CDP Domain Classes: Auto-generated classes from Chrome DevTools Protocol definitions covering 16+ domains (runtime, page, network, fetch, etc.)
  • Service Registration: Automatic CDP version detection and registration via v115CdpInfo service provider

This layered architecture allows developers to use either high-level idealized APIs for common use cases or drop down to low-level CDP commands for advanced scenarios.

Capabilities

Domain Management

Central access point for all Chrome DevTools Protocol domains, providing unified initialization and lifecycle management.

public class v115Domains implements Domains {
    public v115Domains(DevTools devtools);
    public Events<?, ?> events();
    public Javascript<?, ?> javascript();
    public Network<?, ?> network();
    public Target target();
    public Log log();
}

Domain Management

Runtime Events & Exception Handling

Comprehensive event handling for console messages, JavaScript exceptions, and runtime events with idealized conversion and filtering capabilities.

public class v115Events extends Events<ConsoleAPICalled, ExceptionThrown> {
    public v115Events(DevTools devtools);
    protected Command<Void> enableRuntime();
    protected Command<Void> disableRuntime();
    protected Event<ConsoleAPICalled> consoleEvent();
    protected Event<ExceptionThrown> exceptionThrownEvent();
    protected ConsoleEvent toConsoleEvent(ConsoleAPICalled event);
    protected JavascriptException toJsException(ExceptionThrown event);
}

Runtime Events

JavaScript Injection & Bindings

JavaScript code injection, binding management, and script execution coordination with full lifecycle control and event monitoring.

public class v115Javascript extends Javascript<ScriptIdentifier, BindingCalled> {
    public v115Javascript(DevTools devtools);
    protected Command<Void> enableRuntime();
    protected Command<Void> disableRuntime();
    protected Command<Void> doAddJsBinding(String scriptName);
    protected Command<Void> doRemoveJsBinding(String scriptName);
    protected Command<ScriptIdentifier> addScriptToEvaluateOnNewDocument(String script);
    protected Command<Void> removeScriptToEvaluateOnNewDocument(ScriptIdentifier id);
    protected Event<BindingCalled> bindingCalledEvent();
    protected String extractPayload(BindingCalled event);
}

JavaScript Integration

Network Interception & Authentication

Advanced network traffic interception, request/response manipulation, authentication handling, and user agent override capabilities.

public class v115Network extends Network<AuthRequired, RequestPaused> {
    public v115Network(DevTools devTools);
    protected Command<Void> setUserAgentOverride(UserAgent userAgent);
    protected Command<Void> enableNetworkCaching();
    protected Command<Void> disableNetworkCaching();
    protected Command<Void> enableFetchForAllPatterns();
    protected Command<Void> disableFetch();
    protected Event<AuthRequired> authRequiredEvent();
    protected Command<Void> continueWithAuth(AuthRequired authRequired, UsernameAndPassword credentials);
    protected Command<Void> cancelAuth(AuthRequired authRequired);
    public Event<RequestPaused> requestPausedEvent();
    public Either<HttpRequest, HttpResponse> createSeMessages(RequestPaused pausedReq);
    protected Command<Void> continueRequest(RequestPaused pausedReq, HttpRequest req);
    protected Command<Void> fulfillRequest(RequestPaused pausedReq, HttpResponse res);
}

Network Operations

Target & Session Management

Browser target (tab/window) management, debugging session control, and multi-target coordination with attachment and detachment capabilities.

public class v115Target implements Target {
    public Command<Void> detachFromTarget(Optional<SessionID> sessionId, Optional<TargetID> targetId);
    public Command<List<TargetInfo>> getTargets();
    public Command<SessionID> attachToTarget(TargetID targetId);
    public Command<Void> setAutoAttach();
    public Event<TargetID> detached();
}

Target Management

Browser Logging

Browser console log collection, filtering, and event stream management with level conversion and timestamp handling.

public class v115Log implements Log {
    public Command<Void> enable();
    public Command<Void> clear();
    public Event<LogEntry> entryAdded();
}

Logging Operations

Core Types

// Service Provider Registration
@AutoService(CdpInfo.class)
public class v115CdpInfo extends CdpInfo {
    public v115CdpInfo();
}

// Idealized Model Types
public class ConsoleEvent {
    public String getType();
    public Instant getTimestamp();
    public List<Object> getArgs();
    public List<String> getMessages();
}

public class ScriptId {
    // Opaque wrapper for script identifiers
}

public class UserAgent {
    public String userAgent();
    public Optional<String> acceptLanguage();
    public Optional<String> platform();
}

// Target Model Types
public class TargetInfo {
    public TargetID getTargetId();
    public String getType();
    public String getTitle();
    public String getUrl();
    public Boolean getAttached();
    public Optional<TargetID> getOpenerId();
    public Optional<BrowserContextID> getBrowserContextId();
}

public class SessionID {
    public String toString();
}

public class TargetID {
    public String toString();
}

// Log Model Types  
public class LogEntry {
    public String getKind();
    public org.openqa.selenium.logging.LogEntry getEntry();
}

// Runtime Model Types
public class RemoteObject {
    public String getType();
    public Object getValue();
}