Chrome DevTools Protocol bindings for Selenium WebDriver version 111
npx @tessl/cli install tessl/maven-org-seleniumhq-selenium--selenium-devtools-v111@4.9.00
# Selenium DevTools v111
1
2
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.
3
4
## Package Information
5
6
- **Package Name**: selenium-devtools-v111
7
- **Package Type**: Maven
8
- **Language**: Java
9
- **Installation**: Add to Maven dependencies:
10
11
```xml
12
<dependency>
13
<groupId>org.seleniumhq.selenium</groupId>
14
<artifactId>selenium-devtools-v111</artifactId>
15
<version>4.9.1</version>
16
</dependency>
17
```
18
19
## Core Imports
20
21
```java
22
import org.openqa.selenium.devtools.v111.v111CdpInfo;
23
import org.openqa.selenium.devtools.v111.v111Domains;
24
```
25
26
Access to domain implementations:
27
28
```java
29
import org.openqa.selenium.devtools.v111.v111Events;
30
import org.openqa.selenium.devtools.v111.v111Javascript;
31
import org.openqa.selenium.devtools.v111.v111Network;
32
import org.openqa.selenium.devtools.v111.v111Log;
33
import org.openqa.selenium.devtools.v111.v111Target;
34
```
35
36
## Basic Usage
37
38
```java
39
import org.openqa.selenium.WebDriver;
40
import org.openqa.selenium.chrome.ChromeDriver;
41
import org.openqa.selenium.devtools.DevTools;
42
import org.openqa.selenium.devtools.v111.v111Domains;
43
44
// Create Chrome driver with DevTools capabilities
45
ChromeDriver driver = new ChromeDriver();
46
DevTools devTools = driver.getDevTools();
47
devTools.createSession();
48
49
// Create domains container
50
v111Domains domains = new v111Domains(devTools);
51
52
// Enable basic domains
53
devTools.send(domains.log().enable());
54
devTools.send(domains.events().enableRuntime());
55
devTools.send(domains.javascript().enableRuntime());
56
devTools.send(domains.target().setAutoAttach());
57
58
// Enable network monitoring
59
devTools.send(domains.network().enableFetchForAllPatterns());
60
61
// Set up basic listeners
62
devTools.addListener(domains.log().entryAdded(), logEntry ->
63
System.out.println("Log: " + logEntry.getEntry().getMessage()));
64
65
devTools.addListener(domains.events().consoleEvent(), consoleEvent ->
66
System.out.println("Console: " + consoleEvent.getType()));
67
68
// Cleanup
69
devTools.close();
70
driver.quit();
71
```
72
73
## Architecture
74
75
The package follows the Selenium DevTools idealized interface pattern:
76
77
- **v111CdpInfo**: AutoService-registered entry point providing CDP version information
78
- **v111Domains**: Main container providing access to all domain implementations
79
- **Domain Classes**: Specialized implementations for each CDP domain (Network, Events, JavaScript, Log, Target)
80
- **Generated CDP Classes**: Protocol-specific classes generated from Chrome DevTools Protocol specifications
81
82
## Capabilities
83
84
### Entry Point and Domain Management
85
86
Core classes for initializing and managing CDP version 111 domains, providing the foundation for all Chrome DevTools Protocol interactions.
87
88
```java { .api }
89
public class v111CdpInfo extends CdpInfo {
90
public v111CdpInfo();
91
}
92
93
public class v111Domains implements Domains {
94
public v111Domains(DevTools devtools);
95
public Events<?, ?> events();
96
public Javascript<?, ?> javascript();
97
public Network<?, ?> network();
98
public Target target();
99
public Log log();
100
}
101
```
102
103
### Network Monitoring and Control
104
105
Network domain implementation for HTTP request/response interception, authentication handling, and caching control. Provides comprehensive network monitoring capabilities for automated testing and debugging.
106
107
```java { .api }
108
public class v111Network extends Network<AuthRequired, RequestPaused> {
109
public v111Network(DevTools devTools);
110
public Event<RequestPaused> requestPausedEvent();
111
public Either<HttpRequest, HttpResponse> createSeMessages(RequestPaused pausedReq);
112
}
113
```
114
115
[Network Domain](./network.md)
116
117
### Event Handling and Runtime
118
119
Event domain implementation for console events, JavaScript exceptions, and runtime event management. Enables monitoring of browser console output and JavaScript execution errors.
120
121
```java { .api }
122
public class v111Events extends Events<ConsoleAPICalled, ExceptionThrown> {
123
public v111Events(DevTools devtools);
124
}
125
```
126
127
[Events Domain](./events.md)
128
129
### JavaScript Management
130
131
JavaScript domain implementation for script injection, binding management, and runtime code evaluation. Provides capabilities for executing JavaScript code and managing runtime bindings.
132
133
```java { .api }
134
public class v111Javascript extends Javascript<ScriptIdentifier, BindingCalled> {
135
public v111Javascript(DevTools devtools);
136
}
137
```
138
139
[JavaScript Domain](./javascript.md)
140
141
### Logging
142
143
Log domain implementation for browser log capture and management. Provides access to browser console logs with level filtering and timestamp information.
144
145
```java { .api }
146
public class v111Log implements org.openqa.selenium.devtools.idealized.log.Log {
147
public Command<Void> enable();
148
public Command<Void> clear();
149
public Event<org.openqa.selenium.devtools.idealized.log.model.LogEntry> entryAdded();
150
}
151
```
152
153
[Logging Domain](./logging.md)
154
155
### Target Management
156
157
Target domain implementation for browser target and session management. Enables control over browser tabs, windows, and debugging sessions.
158
159
```java { .api }
160
public class v111Target implements org.openqa.selenium.devtools.idealized.target.Target {
161
public Command<Void> detachFromTarget(Optional<SessionID> sessionId, Optional<TargetID> targetId);
162
public Command<List<org.openqa.selenium.devtools.idealized.target.model.TargetInfo>> getTargets();
163
public Command<SessionID> attachToTarget(TargetID targetId);
164
public Command<Void> setAutoAttach();
165
public Event<TargetID> detached();
166
}
167
```
168
169
[Target Domain](./target.md)
170
171
## Types
172
173
### Core DevTools Types
174
175
```java { .api }
176
// DevTools communication types
177
interface Command<T> // Represents CDP commands returning type T
178
interface Event<T> // Represents CDP events of type T
179
class DevTools // Main DevTools communication interface
180
181
// Generic response types
182
class Either<L, R> // Represents value that can be left (L) or right (R) type
183
```
184
185
### Domain-Specific Types
186
187
```java { .api }
188
// Network domain types
189
class AuthRequired // Authentication challenge event
190
class RequestPaused // Request interception event
191
class UsernameAndPassword // Authentication credentials
192
class HttpRequest // HTTP request representation
193
class HttpResponse // HTTP response representation
194
195
// JavaScript domain types
196
class ScriptIdentifier // Identifier for injected scripts
197
class BindingCalled // JavaScript binding invocation event
198
199
// Events domain types
200
class ConsoleAPICalled // Console API invocation event
201
class ExceptionThrown // JavaScript exception event
202
class ConsoleEvent // Processed console event
203
class JavascriptException // JavaScript exception wrapper
204
205
// Target domain types
206
class TargetID // Unique target identifier
207
class SessionID // DevTools session identifier
208
class TargetInfo // Target information container
209
class BrowserContextID // Browser context identifier
210
211
// Log domain types
212
class LogEntry // Browser log entry
213
class Level // Log level enumeration
214
class Timestamp // CDP timestamp representation
215
```