Chrome DevTools Protocol (CDP) bindings for Java - version 110, enabling advanced browser automation features like network interception, console event handling, JavaScript execution, and target management.
npx @tessl/cli install tessl/maven-org-seleniumhq-selenium--selenium-devtools-v110@4.9.0Selenium DevTools v110 provides Chrome DevTools Protocol (CDP) bindings specifically for Chrome browser version 110. This package enables Java developers to access advanced browser automation capabilities beyond standard WebDriver functionality, including network monitoring and interception, JavaScript execution and evaluation, console and logging functionality, browser target management, and sophisticated event handling.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-devtools-v110</artifactId>
<version>4.9.0</version>
</dependency>import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.v110.v110Domains;
import org.openqa.selenium.devtools.v110.v110CdpInfo;For specific domain functionality:
import org.openqa.selenium.devtools.v110.v110Network;
import org.openqa.selenium.devtools.v110.v110Events;
import org.openqa.selenium.devtools.v110.v110Javascript;
import org.openqa.selenium.devtools.v110.v110Log;
import org.openqa.selenium.devtools.v110.v110Target;import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.v110.v110Domains;
import org.openqa.selenium.devtools.v110.network.Network;
// Create Chrome driver and get DevTools session
ChromeDriver driver = new ChromeDriver();
DevTools devTools = driver.getDevTools();
devTools.createSession();
// Initialize v110 domains
v110Domains domains = new v110Domains(devTools);
// Enable network monitoring
devTools.send(Network.enable(Optional.empty(), Optional.empty(), Optional.empty()));
// Add authentication handler
domains.network().addAuthHandler(
uri -> uri.contains("secure-site.com"),
new UsernameAndPassword("username", "password")
);
// Listen for console events
domains.events().addConsoleListener(event -> {
System.out.println("Console: " + event.getMessages());
});
// Navigate and observe network/console activity
driver.get("https://example.com");The v110 package follows Selenium's idealized DevTools API pattern with several key components:
v110CdpInfo automatically registers the v110 CDP version with Selenium's service discoveryv110Domains provides centralized access to all CDP domain implementationsv110Network, v110Events, etc.) that wrap auto-generated CDP protocol classesAdvanced network functionality including request/response interception, authentication handling, user agent modification, and traffic monitoring.
public class v110Network extends Network<AuthRequired, RequestPaused> {
public v110Network(DevTools devTools);
}JavaScript console monitoring, exception tracking, and runtime event handling with full Chrome DevTools integration.
public class v110Events extends Events<ConsoleAPICalled, ExceptionThrown> {
public v110Events(DevTools devtools);
}JavaScript evaluation, runtime bindings, and script injection capabilities for advanced browser interaction.
public class v110Javascript extends Javascript<ScriptIdentifier, BindingCalled> {
public v110Javascript(DevTools devtools);
}Target discovery, attachment, and management for working with browser tabs, workers, and other execution contexts.
public class v110Target implements org.openqa.selenium.devtools.idealized.target.Target {
// Target management methods
}Access to browser logs including console messages, network logs, and other diagnostic information.
public class v110Log implements org.openqa.selenium.devtools.idealized.log.Log {
public v110Log();
Command<Void> enable();
Command<Void> clear();
Event<org.openqa.selenium.devtools.idealized.log.model.LogEntry> entryAdded();
}The package automatically generates complete Java bindings for all CDP v110 domains:
// Runtime domain for JavaScript execution
org.openqa.selenium.devtools.v110.runtime.Runtime
// Network domain for HTTP monitoring
org.openqa.selenium.devtools.v110.network.Network
// Fetch domain for request interception
org.openqa.selenium.devtools.v110.fetch.Fetch
// Page domain for page-level operations
org.openqa.selenium.devtools.v110.page.Page
// Target domain for target management
org.openqa.selenium.devtools.v110.target.Target
// Log domain for browser logging
org.openqa.selenium.devtools.v110.log.Logimport org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.Event;
// DevTools session for sending commands and receiving events
public class DevTools {
void createSession();
<T> T send(Command<T> command);
void addListener(Event<T> event, Consumer<T> listener);
}
// Represents a CDP command
public interface Command<T> {
String getMethod();
Map<String, Object> getParams();
}
// Represents a CDP event
public interface Event<T> {
String getMethod();
}CDP operations may throw various exceptions that should be handled appropriately:
import org.openqa.selenium.devtools.DevToolsException;
import org.openqa.selenium.JavascriptException;
// General DevTools protocol errors
public class DevToolsException extends RuntimeException {
// Thrown when CDP commands fail or timeout
}
// JavaScript execution errors
public class JavascriptException extends RuntimeException {
// Thrown when JavaScript evaluation fails
}