CtrlK
BlogDocsLog inGet started
Tessl Logo

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

Java bindings for Chrome DevTools Protocol version 101, enabling browser automation and debugging capabilities through CDP integration

Pending
Overview
Eval results
Files

entry-point.mddocs/

Entry Point and Domain Management

The entry point and domain management components provide the main access points for Chrome DevTools Protocol version 101 functionality and organize CDP capabilities into logical domains.

Capabilities

V101CdpInfo

Entry point class that provides version-specific CDP implementation and domain access.

/**
 * Entry point for Chrome DevTools Protocol version 101
 * Extends CdpInfo and is automatically discovered via Java ServiceLoader
 */
@AutoService(CdpInfo.class)
public class V101CdpInfo extends CdpInfo {
    
    /**
     * Creates a new V101CdpInfo instance configured for CDP version 101
     */
    public V101CdpInfo();
}

Inherited Methods from CdpInfo Base Class:

/**
 * Get the major version number for this CDP implementation
 * @return 101 for this implementation
 */
public int getMajorVersion();

/**
 * Get the domains implementation for this CDP version
 * @param devTools DevTools instance for communication
 * @return V101Domains instance providing access to all CDP domains
 */
public Domains getDomains(DevTools devTools);

/**
 * Compare this CDP version with another
 * @param that Other CdpInfo to compare against
 * @return Comparison result based on major version
 */
public int compareTo(CdpInfo that);

Usage Example:

import org.openqa.selenium.devtools.v101.V101CdpInfo;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.idealized.Domains;

// Create CDP info for version 101
V101CdpInfo cdpInfo = new V101CdpInfo();

// Verify version
System.out.println("CDP Version: " + cdpInfo.getMajorVersion()); // Prints: 101

// Get domains for a DevTools session
Domains domains = cdpInfo.getDomains(devTools);

V101Domains

Central domain aggregator that provides organized access to all CDP functionality areas.

/**
 * Aggregates all available CDP domains for version 101
 * Provides organized access to events, javascript, network, target, and log domains
 */
public class V101Domains implements Domains {
    
    /**
     * Creates a new domain aggregator instance
     * @param devtools DevTools instance for CDP communication
     * @throws NullPointerException if devtools is null
     */
    public V101Domains(DevTools devtools);
    
    /**
     * Get the events domain for console and runtime event handling
     * @return V101Events instance for managing console events and JavaScript exceptions
     */
    @Override
    public Events<?, ?> events();
    
    /**
     * Get the javascript domain for script evaluation and bindings
     * @return V101Javascript instance for managing JavaScript bindings and script injection
     */
    @Override
    public Javascript<?, ?> javascript();
    
    /**
     * Get the network domain for traffic interception and authentication
     * @return V101Network instance for network monitoring and manipulation
     */
    @Override
    public Network<?, ?> network();
    
    /**
     * Get the target domain for browser context and session management
     * @return V101Target instance for managing browser targets and sessions
     */
    @Override
    public Target target();
    
    /**
     * Get the log domain for browser logging functionality
     * @return V101Log instance for managing browser logs
     */
    @Override
    public Log log();
    
    /**
     * Disable all active domains to clean up resources
     * Calls disable() on events, javascript, and network domains
     */
    @Override
    public void disableAll();
}

Usage Example:

import org.openqa.selenium.devtools.v101.V101Domains;
import org.openqa.selenium.devtools.DevTools;

// Create domains aggregator
V101Domains domains = new V101Domains(devTools);

// Access individual domains
var events = domains.events();
var javascript = domains.javascript();
var network = domains.network();
var target = domains.target();
var log = domains.log();

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

// Add network interception
network.interceptTrafficWith(request -> {
    System.out.println("Request: " + request.getUri());
    return next -> next.execute(request);
});

// Clean up when done
domains.disableAll();

Base CdpInfo Interface

/**
 * Base interface for CDP version information and domain access
 * Implemented by version-specific classes like V101CdpInfo
 */
public abstract class CdpInfo implements Comparable<CdpInfo> {
    
    /**
     * Get the major version number for this CDP implementation
     * @return Major version number (e.g., 101)
     */
    public abstract int getMajorVersion();
    
    /**
     * Get the domains implementation for this CDP version
     * @param devTools DevTools instance for communication
     * @return Domains instance providing access to CDP functionality
     */
    public abstract Domains getDomains(DevTools devTools);
    
    /**
     * Compare CDP versions by major version number
     * @param that Other CdpInfo to compare against
     * @return Negative, zero, or positive based on version comparison
     */
    public int compareTo(CdpInfo that);
}

Base Domains Interface

/**
 * Interface defining access to all CDP domain implementations
 * Provides organized access to browser development tools functionality
 */
public interface Domains {
    
    /**
     * Get the events domain for runtime and console event handling
     * @return Events implementation for this CDP version
     */
    Events<?, ?> events();
    
    /**
     * Get the javascript domain for script evaluation and bindings
     * @return Javascript implementation for this CDP version
     */
    Javascript<?, ?> javascript();
    
    /**
     * Get the network domain for traffic monitoring and manipulation
     * @return Network implementation for this CDP version
     */
    Network<?, ?> network();
    
    /**
     * Get the target domain for browser context management
     * @return Target implementation for this CDP version
     */
    Target target();
    
    /**
     * Get the log domain for browser logging
     * @return Log implementation for this CDP version
     */
    Log log();
    
    /**
     * Disable all domains to clean up resources and event listeners
     */
    void disableAll();
}

Domain Lifecycle Management

Initialization Pattern:

// Standard initialization sequence
ChromeDriver driver = new ChromeDriver();
DevTools devTools = driver.getDevTools();
devTools.createSession();

V101CdpInfo cdpInfo = new V101CdpInfo();
Domains domains = cdpInfo.getDomains(devTools);

// Use domains...

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

Error Handling:

try {
    V101Domains domains = new V101Domains(devTools);
    // Use domains...
} catch (Exception e) {
    // Handle CDP communication errors
    System.err.println("CDP Error: " + e.getMessage());
} finally {
    // Always clean up resources
    if (domains != null) {
        domains.disableAll();
    }
}

Install with Tessl CLI

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

docs

entry-point.md

events.md

index.md

javascript.md

logging.md

network.md

target.md

tile.json