0
# Selenium DevTools v133
1
2
Selenium DevTools v133 provides Java bindings for Chrome DevTools Protocol (CDP) version 133, enabling advanced browser automation capabilities through Selenium WebDriver. This package offers comprehensive access to browser debugging and automation features including network monitoring, JavaScript execution control, event handling, logging, and target management.
3
4
## Package Information
5
6
- **Package Name**: selenium-devtools-v133
7
- **Package Type**: Maven
8
- **Language**: Java
9
- **Maven Coordinates**: `org.seleniumhq.selenium:selenium-devtools-v133:4.31.0`
10
- **Installation**: Include as Maven dependency or download from Maven Central
11
12
## Core Imports
13
14
```java
15
import org.openqa.selenium.devtools.v133.v133Domains;
16
import org.openqa.selenium.devtools.v133.v133CdpInfo;
17
import org.openqa.selenium.devtools.DevTools;
18
```
19
20
## Basic Usage
21
22
```java
23
import org.openqa.selenium.chrome.ChromeDriver;
24
import org.openqa.selenium.devtools.DevTools;
25
import org.openqa.selenium.devtools.v133.v133Domains;
26
27
// Create a Chrome WebDriver instance
28
ChromeDriver driver = new ChromeDriver();
29
30
// Get DevTools instance
31
DevTools devTools = driver.getDevTools();
32
devTools.createSession();
33
34
// Create v133 domains
35
v133Domains domains = new v133Domains(devTools);
36
37
// Access specific domain functionality
38
devTools.send(domains.log().enable());
39
40
// Listen for log entries
41
devTools.addListener(domains.log().entryAdded(), logEntry -> {
42
System.out.println("Browser log: " + logEntry.getLogEntry().getMessage());
43
});
44
45
// Clean up
46
devTools.close();
47
driver.quit();
48
```
49
50
## Architecture
51
52
Selenium DevTools v133 is built around several key components:
53
54
- **CDP Version Support**: Specifically implements Chrome DevTools Protocol version 133
55
- **Domain-Based API**: Organizes functionality into logical domains (Events, JavaScript, Network, Log, Target)
56
- **Generated Code Integration**: Uses generated CDP domain classes from protocol specifications
57
- **DevTools Bridge**: Seamlessly integrates with Selenium's DevTools infrastructure
58
- **Type Safety**: Provides strongly-typed Java interfaces for all CDP operations
59
60
## Capabilities
61
62
### Core Setup and Initialization
63
64
Central factory and registration classes for setting up CDP v133 support within Selenium WebDriver.
65
66
```java { .api }
67
public class v133CdpInfo extends CdpInfo {
68
public v133CdpInfo();
69
}
70
71
public class v133Domains implements Domains {
72
public v133Domains(DevTools devtools);
73
public Events<?, ?> events();
74
public Javascript<?, ?> javascript();
75
public Network<?, ?> network();
76
public Target target();
77
public Log log();
78
}
79
```
80
81
### Event Handling
82
83
Monitor browser runtime events, console API calls, and JavaScript exceptions with detailed error information and stack traces.
84
85
```java { .api }
86
public class v133Events extends Events<ConsoleAPICalled, ExceptionThrown> {
87
public v133Events(DevTools devtools);
88
}
89
```
90
91
[Event Handling](./events.md)
92
93
### JavaScript Control
94
95
Execute custom JavaScript, manage script bindings, and inject scripts that run on new document creation.
96
97
```java { .api }
98
public class v133Javascript extends Javascript<ScriptIdentifier, BindingCalled> {
99
public v133Javascript(DevTools devtools);
100
}
101
```
102
103
[JavaScript Control](./javascript.md)
104
105
### Network Monitoring and Interception
106
107
Monitor network activity, intercept requests and responses, handle authentication challenges, and modify network behavior.
108
109
```java { .api }
110
public class v133Network extends Network<AuthRequired, RequestPaused> {
111
public v133Network(DevTools devTools);
112
public Event<RequestPaused> requestPausedEvent();
113
public Either<HttpRequest, HttpResponse> createSeMessages(RequestPaused pausedReq);
114
}
115
```
116
117
[Network Monitoring](./network.md)
118
119
### Log Management
120
121
Monitor and manage browser logs with filtering by level and source, providing real-time access to browser debugging information.
122
123
```java { .api }
124
public class v133Log implements org.openqa.selenium.devtools.idealized.log.Log {
125
public Command<Void> enable();
126
public Command<Void> clear();
127
public Event<org.openqa.selenium.devtools.idealized.log.model.LogEntry> entryAdded();
128
}
129
```
130
131
[Log Management](./logging.md)
132
133
### Target Management
134
135
Manage browser contexts, tabs, and debugging sessions with support for multi-target debugging scenarios.
136
137
```java { .api }
138
public class v133Target implements org.openqa.selenium.devtools.idealized.target.Target {
139
public Command<Void> detachFromTarget(Optional<SessionID> sessionId, Optional<TargetID> targetId);
140
public Command<List<org.openqa.selenium.devtools.idealized.target.model.TargetInfo>> getTargets();
141
public Command<SessionID> attachToTarget(TargetID targetId);
142
public Command<Void> setAutoAttach();
143
public Event<TargetID> detached();
144
}
145
```
146
147
[Target Management](./targets.md)
148
149
## Generated CDP Domain Classes
150
151
The package includes generated CDP domain classes based on Chrome DevTools Protocol v133 specifications. These classes are generated at build time from the protocol definition files and provide complete Java bindings for all CDP domains.
152
153
### Available CDP Domain Packages
154
155
```java { .api }
156
// Core browser and page management domains
157
import org.openqa.selenium.devtools.v133.browser.*; // Browser-level operations
158
import org.openqa.selenium.devtools.v133.page.*; // Page lifecycle and navigation
159
import org.openqa.selenium.devtools.v133.target.*; // Target/tab management
160
161
// JavaScript runtime and debugging domains
162
import org.openqa.selenium.devtools.v133.runtime.*; // JavaScript runtime control
163
import org.openqa.selenium.devtools.v133.debugger.*; // JavaScript debugging
164
import org.openqa.selenium.devtools.v133.profiler.*; // JavaScript profiling
165
166
// Network and communication domains
167
import org.openqa.selenium.devtools.v133.network.*; // Network monitoring
168
import org.openqa.selenium.devtools.v133.fetch.*; // Request interception
169
import org.openqa.selenium.devtools.v133.io.*; // Input/Output operations
170
171
// DOM and rendering domains
172
import org.openqa.selenium.devtools.v133.dom.*; // DOM manipulation
173
import org.openqa.selenium.devtools.v133.domdebugger.*; // DOM debugging
174
175
// Device and environment emulation
176
import org.openqa.selenium.devtools.v133.emulation.*; // Device emulation
177
import org.openqa.selenium.devtools.v133.input.*; // Input simulation
178
179
// Monitoring and diagnostics domains
180
import org.openqa.selenium.devtools.v133.log.*; // Browser logging
181
import org.openqa.selenium.devtools.v133.performance.*; // Performance monitoring
182
import org.openqa.selenium.devtools.v133.tracing.*; // Chrome tracing
183
import org.openqa.selenium.devtools.v133.security.*; // Security state
184
```
185
186
### Key Generated Model Classes
187
188
Each domain package contains a `model` subpackage with data types and event structures:
189
190
```java { .api }
191
// Runtime domain model classes
192
import org.openqa.selenium.devtools.v133.runtime.model.ConsoleAPICalled;
193
import org.openqa.selenium.devtools.v133.runtime.model.ExceptionThrown;
194
import org.openqa.selenium.devtools.v133.runtime.model.BindingCalled;
195
import org.openqa.selenium.devtools.v133.runtime.model.RemoteObject;
196
import org.openqa.selenium.devtools.v133.runtime.model.ExceptionDetails;
197
import org.openqa.selenium.devtools.v133.runtime.model.StackTrace;
198
import org.openqa.selenium.devtools.v133.runtime.model.Timestamp;
199
200
// Page domain model classes
201
import org.openqa.selenium.devtools.v133.page.model.ScriptIdentifier;
202
import org.openqa.selenium.devtools.v133.page.model.Frame;
203
import org.openqa.selenium.devtools.v133.page.model.NavigationEntry;
204
205
// Network domain model classes
206
import org.openqa.selenium.devtools.v133.network.model.Request;
207
import org.openqa.selenium.devtools.v133.network.model.Response;
208
import org.openqa.selenium.devtools.v133.network.model.LoadingFinished;
209
import org.openqa.selenium.devtools.v133.network.model.RequestWillBeSent;
210
211
// Fetch domain model classes
212
import org.openqa.selenium.devtools.v133.fetch.model.AuthRequired;
213
import org.openqa.selenium.devtools.v133.fetch.model.RequestPaused;
214
import org.openqa.selenium.devtools.v133.fetch.model.AuthChallenge;
215
import org.openqa.selenium.devtools.v133.fetch.model.AuthChallengeResponse;
216
import org.openqa.selenium.devtools.v133.fetch.model.HeaderEntry;
217
import org.openqa.selenium.devtools.v133.fetch.model.RequestPattern;
218
219
// Target domain model classes
220
import org.openqa.selenium.devtools.v133.target.model.TargetInfo;
221
import org.openqa.selenium.devtools.v133.target.model.SessionID;
222
import org.openqa.selenium.devtools.v133.target.model.TargetID;
223
import org.openqa.selenium.devtools.v133.target.model.BrowserContextID;
224
225
// Log domain model classes
226
import org.openqa.selenium.devtools.v133.log.model.LogEntry;
227
```
228
229
### Core DevTools Types
230
231
Basic infrastructure types used throughout the DevTools API:
232
233
```java { .api }
234
// From org.openqa.selenium.devtools
235
public interface Command<T> {
236
// Represents a DevTools command that returns type T
237
}
238
239
public interface Event<T> {
240
// Represents a DevTools event with payload type T
241
}
242
243
public class DevTools {
244
// Main DevTools communication interface
245
public void createSession();
246
public <T> T send(Command<T> command);
247
public <T> void addListener(Event<T> event, Consumer<T> listener);
248
public void close();
249
}
250
251
// From org.openqa.selenium.internal
252
public class Either<L, R> {
253
public boolean isLeft();
254
public boolean isRight();
255
public L left();
256
public R right();
257
public static <L, R> Either<L, R> left(L value);
258
public static <L, R> Either<L, R> right(R value);
259
}
260
261
// From org.openqa.selenium
262
public class UsernameAndPassword {
263
public UsernameAndPassword(String username, String password);
264
public String username();
265
public String password();
266
}
267
```
268
269
## Dependencies
270
271
```xml
272
<dependency>
273
<groupId>org.seleniumhq.selenium</groupId>
274
<artifactId>selenium-devtools-v133</artifactId>
275
<version>4.31.0</version>
276
</dependency>
277
```
278
279
Required transitive dependencies:
280
- `org.seleniumhq.selenium:selenium-java` (core Selenium functionality)
281
- `org.seleniumhq.selenium:selenium-remote-driver` (remote WebDriver support)
282
- `org.seleniumhq.selenium:selenium-support` (WebDriver support classes)
283
284
## Version Compatibility
285
286
This package is specifically designed for Chrome DevTools Protocol version 133 and is compatible with:
287
- Chrome/Chromium browsers version 133 and related versions
288
- Selenium WebDriver 4.31.0 and compatible versions
289
- Java 11 or higher