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.00
# Selenium DevTools v110
1
2
Selenium 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.
3
4
## Package Information
5
6
- **Package Name**: selenium-devtools-v110
7
- **Package Type**: Maven
8
- **Language**: Java
9
- **Group ID**: org.seleniumhq.selenium
10
- **Artifact ID**: selenium-devtools-v110
11
- **Version**: 4.9.0
12
- **Installation**:
13
```xml
14
<dependency>
15
<groupId>org.seleniumhq.selenium</groupId>
16
<artifactId>selenium-devtools-v110</artifactId>
17
<version>4.9.0</version>
18
</dependency>
19
```
20
21
## Core Imports
22
23
```java
24
import org.openqa.selenium.devtools.DevTools;
25
import org.openqa.selenium.devtools.v110.v110Domains;
26
import org.openqa.selenium.devtools.v110.v110CdpInfo;
27
```
28
29
For specific domain functionality:
30
31
```java
32
import org.openqa.selenium.devtools.v110.v110Network;
33
import org.openqa.selenium.devtools.v110.v110Events;
34
import org.openqa.selenium.devtools.v110.v110Javascript;
35
import org.openqa.selenium.devtools.v110.v110Log;
36
import org.openqa.selenium.devtools.v110.v110Target;
37
```
38
39
## Basic Usage
40
41
```java
42
import org.openqa.selenium.chrome.ChromeDriver;
43
import org.openqa.selenium.devtools.DevTools;
44
import org.openqa.selenium.devtools.v110.v110Domains;
45
import org.openqa.selenium.devtools.v110.network.Network;
46
47
// Create Chrome driver and get DevTools session
48
ChromeDriver driver = new ChromeDriver();
49
DevTools devTools = driver.getDevTools();
50
devTools.createSession();
51
52
// Initialize v110 domains
53
v110Domains domains = new v110Domains(devTools);
54
55
// Enable network monitoring
56
devTools.send(Network.enable(Optional.empty(), Optional.empty(), Optional.empty()));
57
58
// Add authentication handler
59
domains.network().addAuthHandler(
60
uri -> uri.contains("secure-site.com"),
61
new UsernameAndPassword("username", "password")
62
);
63
64
// Listen for console events
65
domains.events().addConsoleListener(event -> {
66
System.out.println("Console: " + event.getMessages());
67
});
68
69
// Navigate and observe network/console activity
70
driver.get("https://example.com");
71
```
72
73
## Architecture
74
75
The v110 package follows Selenium's idealized DevTools API pattern with several key components:
76
77
- **CDP Info Service**: `v110CdpInfo` automatically registers the v110 CDP version with Selenium's service discovery
78
- **Domains Container**: `v110Domains` provides centralized access to all CDP domain implementations
79
- **Domain Wrappers**: High-level Java classes (`v110Network`, `v110Events`, etc.) that wrap auto-generated CDP protocol classes
80
- **Generated CDP Classes**: Complete Java bindings for all CDP domains auto-generated from Chrome DevTools Protocol specifications
81
- **Idealized API**: Common interfaces across CDP versions for forward/backward compatibility
82
83
## Capabilities
84
85
### Network Monitoring and Interception
86
87
Advanced network functionality including request/response interception, authentication handling, user agent modification, and traffic monitoring.
88
89
```java { .api }
90
public class v110Network extends Network<AuthRequired, RequestPaused> {
91
public v110Network(DevTools devTools);
92
}
93
```
94
95
[Network Operations](./network.md)
96
97
### Console and Runtime Events
98
99
JavaScript console monitoring, exception tracking, and runtime event handling with full Chrome DevTools integration.
100
101
```java { .api }
102
public class v110Events extends Events<ConsoleAPICalled, ExceptionThrown> {
103
public v110Events(DevTools devtools);
104
}
105
```
106
107
[Event Handling](./events.md)
108
109
### JavaScript Execution and Bindings
110
111
JavaScript evaluation, runtime bindings, and script injection capabilities for advanced browser interaction.
112
113
```java { .api }
114
public class v110Javascript extends Javascript<ScriptIdentifier, BindingCalled> {
115
public v110Javascript(DevTools devtools);
116
}
117
```
118
119
[JavaScript Operations](./javascript.md)
120
121
### Browser Target Management
122
123
Target discovery, attachment, and management for working with browser tabs, workers, and other execution contexts.
124
125
```java { .api }
126
public class v110Target implements org.openqa.selenium.devtools.idealized.target.Target {
127
// Target management methods
128
}
129
```
130
131
[Target Management](./target.md)
132
133
### Browser Logging
134
135
Access to browser logs including console messages, network logs, and other diagnostic information.
136
137
```java { .api }
138
public class v110Log implements org.openqa.selenium.devtools.idealized.log.Log {
139
public v110Log();
140
Command<Void> enable();
141
Command<Void> clear();
142
Event<org.openqa.selenium.devtools.idealized.log.model.LogEntry> entryAdded();
143
}
144
```
145
146
[Logging Operations](./logging.md)
147
148
## CDP Domain Integration
149
150
### Generated Domain Classes
151
152
The package automatically generates complete Java bindings for all CDP v110 domains:
153
154
```java { .api }
155
// Runtime domain for JavaScript execution
156
org.openqa.selenium.devtools.v110.runtime.Runtime
157
158
// Network domain for HTTP monitoring
159
org.openqa.selenium.devtools.v110.network.Network
160
161
// Fetch domain for request interception
162
org.openqa.selenium.devtools.v110.fetch.Fetch
163
164
// Page domain for page-level operations
165
org.openqa.selenium.devtools.v110.page.Page
166
167
// Target domain for target management
168
org.openqa.selenium.devtools.v110.target.Target
169
170
// Log domain for browser logging
171
org.openqa.selenium.devtools.v110.log.Log
172
```
173
174
### Core DevTools Types
175
176
```java { .api }
177
import org.openqa.selenium.devtools.DevTools;
178
import org.openqa.selenium.devtools.Command;
179
import org.openqa.selenium.devtools.Event;
180
181
// DevTools session for sending commands and receiving events
182
public class DevTools {
183
void createSession();
184
<T> T send(Command<T> command);
185
void addListener(Event<T> event, Consumer<T> listener);
186
}
187
188
// Represents a CDP command
189
public interface Command<T> {
190
String getMethod();
191
Map<String, Object> getParams();
192
}
193
194
// Represents a CDP event
195
public interface Event<T> {
196
String getMethod();
197
}
198
```
199
200
## Error Handling
201
202
CDP operations may throw various exceptions that should be handled appropriately:
203
204
```java { .api }
205
import org.openqa.selenium.devtools.DevToolsException;
206
import org.openqa.selenium.JavascriptException;
207
208
// General DevTools protocol errors
209
public class DevToolsException extends RuntimeException {
210
// Thrown when CDP commands fail or timeout
211
}
212
213
// JavaScript execution errors
214
public class JavascriptException extends RuntimeException {
215
// Thrown when JavaScript evaluation fails
216
}
217
```