Chrome DevTools Protocol bindings for Selenium WebDriver version 111
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Chrome DevTools Protocol (CDP) bindings specifically for Chrome version 111, enabling Java applications to interact with Chrome's debugging and development tools through a programmatic interface. This package provides comprehensive access to CDP domains for network monitoring, JavaScript execution, event handling, logging, and target management.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-devtools-v111</artifactId>
<version>4.9.1</version>
</dependency>import org.openqa.selenium.devtools.v111.v111CdpInfo;
import org.openqa.selenium.devtools.v111.v111Domains;Access to domain implementations:
import org.openqa.selenium.devtools.v111.v111Events;
import org.openqa.selenium.devtools.v111.v111Javascript;
import org.openqa.selenium.devtools.v111.v111Network;
import org.openqa.selenium.devtools.v111.v111Log;
import org.openqa.selenium.devtools.v111.v111Target;import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.v111.v111Domains;
// Create Chrome driver with DevTools capabilities
ChromeDriver driver = new ChromeDriver();
DevTools devTools = driver.getDevTools();
devTools.createSession();
// Create domains container
v111Domains domains = new v111Domains(devTools);
// Enable basic domains
devTools.send(domains.log().enable());
devTools.send(domains.events().enableRuntime());
devTools.send(domains.javascript().enableRuntime());
devTools.send(domains.target().setAutoAttach());
// Enable network monitoring
devTools.send(domains.network().enableFetchForAllPatterns());
// Set up basic listeners
devTools.addListener(domains.log().entryAdded(), logEntry ->
System.out.println("Log: " + logEntry.getEntry().getMessage()));
devTools.addListener(domains.events().consoleEvent(), consoleEvent ->
System.out.println("Console: " + consoleEvent.getType()));
// Cleanup
devTools.close();
driver.quit();The package follows the Selenium DevTools idealized interface pattern:
Core classes for initializing and managing CDP version 111 domains, providing the foundation for all Chrome DevTools Protocol interactions.
public class v111CdpInfo extends CdpInfo {
public v111CdpInfo();
}
public class v111Domains implements Domains {
public v111Domains(DevTools devtools);
public Events<?, ?> events();
public Javascript<?, ?> javascript();
public Network<?, ?> network();
public Target target();
public Log log();
}Network domain implementation for HTTP request/response interception, authentication handling, and caching control. Provides comprehensive network monitoring capabilities for automated testing and debugging.
public class v111Network extends Network<AuthRequired, RequestPaused> {
public v111Network(DevTools devTools);
public Event<RequestPaused> requestPausedEvent();
public Either<HttpRequest, HttpResponse> createSeMessages(RequestPaused pausedReq);
}Event domain implementation for console events, JavaScript exceptions, and runtime event management. Enables monitoring of browser console output and JavaScript execution errors.
public class v111Events extends Events<ConsoleAPICalled, ExceptionThrown> {
public v111Events(DevTools devtools);
}JavaScript domain implementation for script injection, binding management, and runtime code evaluation. Provides capabilities for executing JavaScript code and managing runtime bindings.
public class v111Javascript extends Javascript<ScriptIdentifier, BindingCalled> {
public v111Javascript(DevTools devtools);
}Log domain implementation for browser log capture and management. Provides access to browser console logs with level filtering and timestamp information.
public class v111Log 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();
}Target domain implementation for browser target and session management. Enables control over browser tabs, windows, and debugging sessions.
public class v111Target 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();
public Event<TargetID> detached();
}// DevTools communication types
interface Command<T> // Represents CDP commands returning type T
interface Event<T> // Represents CDP events of type T
class DevTools // Main DevTools communication interface
// Generic response types
class Either<L, R> // Represents value that can be left (L) or right (R) type// Network domain types
class AuthRequired // Authentication challenge event
class RequestPaused // Request interception event
class UsernameAndPassword // Authentication credentials
class HttpRequest // HTTP request representation
class HttpResponse // HTTP response representation
// JavaScript domain types
class ScriptIdentifier // Identifier for injected scripts
class BindingCalled // JavaScript binding invocation event
// Events domain types
class ConsoleAPICalled // Console API invocation event
class ExceptionThrown // JavaScript exception event
class ConsoleEvent // Processed console event
class JavascriptException // JavaScript exception wrapper
// Target domain types
class TargetID // Unique target identifier
class SessionID // DevTools session identifier
class TargetInfo // Target information container
class BrowserContextID // Browser context identifier
// Log domain types
class LogEntry // Browser log entry
class Level // Log level enumeration
class Timestamp // CDP timestamp representation