0
# Domain Management
1
2
Core functionality for managing CDP domains and creating the main entry point for all DevTools operations. This module provides the foundational classes needed to establish connections and access specific CDP domain functionality.
3
4
## Capabilities
5
6
### V102Domains Class
7
8
Main entry point providing access to all CDP domain implementations. This class serves as a factory and container for all domain-specific wrappers, enabling coordinated access to Chrome DevTools Protocol functionality.
9
10
```java { .api }
11
/**
12
* Main entry point providing access to all CDP domain implementations
13
*/
14
public class V102Domains implements Domains {
15
/**
16
* Creates a new V102Domains instance with the specified DevTools connection
17
* @param devtools DevTools connection instance (required, non-null)
18
*/
19
public V102Domains(DevTools devtools);
20
21
/**
22
* Returns the Events domain for handling runtime events and console operations
23
* @return V102Events instance for event handling
24
*/
25
public Events<?, ?> events();
26
27
/**
28
* Returns the Javascript domain for script execution and binding operations
29
* @return V102Javascript instance for JavaScript operations
30
*/
31
public Javascript<?, ?> javascript();
32
33
/**
34
* Returns the Network domain for network operations and request interception
35
* @return V102Network instance for network operations
36
*/
37
public Network<?, ?> network();
38
39
/**
40
* Returns the Target domain for browser target management
41
* @return V102Target instance for target operations
42
*/
43
public Target target();
44
45
/**
46
* Returns the Log domain for console log management
47
* @return V102Log instance for log operations
48
*/
49
public Log log();
50
51
/**
52
* Disables all domains (events, javascript, and network)
53
* Note: Deliberately does not disable targets or log domains
54
*/
55
public void disableAll();
56
}
57
```
58
59
**Usage Examples:**
60
61
```java
62
import org.openqa.selenium.chrome.ChromeDriver;
63
import org.openqa.selenium.devtools.DevTools;
64
import org.openqa.selenium.devtools.v102.V102Domains;
65
66
// Basic setup
67
ChromeDriver driver = new ChromeDriver();
68
DevTools devTools = driver.getDevTools();
69
devTools.createSession();
70
71
// Create domains instance
72
V102Domains domains = new V102Domains(devTools);
73
74
// Access specific domains
75
domains.network().enableNetworkCaching();
76
domains.events().enable();
77
domains.javascript().enable();
78
79
// Perform operations...
80
81
// Cleanup all domains at once
82
domains.disableAll();
83
```
84
85
### V102CdpInfo Class
86
87
CDP version information provider for v102. This class implements the service provider interface for Chrome DevTools Protocol version 102, enabling automatic discovery and registration within the Selenium DevTools framework.
88
89
```java { .api }
90
/**
91
* CDP version information provider for v102
92
* Annotated with @AutoService for automatic service discovery
93
*/
94
@AutoService(CdpInfo.class)
95
public class V102CdpInfo extends CdpInfo {
96
/**
97
* Creates CDP info for version 102 with V102Domains factory
98
* Automatically registers version 102 with V102Domains constructor
99
*/
100
public V102CdpInfo();
101
}
102
```
103
104
**Usage Examples:**
105
106
```java
107
// V102CdpInfo is typically used automatically by the framework
108
// It registers version 102 support and provides the V102Domains factory
109
110
// Direct usage (rare, usually handled by framework):
111
V102CdpInfo cdpInfo = new V102CdpInfo();
112
// Version 102 is now registered and available for DevTools sessions
113
```
114
115
### Domains Interface
116
117
The idealized interface that V102Domains implements, providing version-agnostic access to CDP functionality.
118
119
```java { .api }
120
/**
121
* The idealized set of CDP domains that Selenium itself needs
122
*/
123
public interface Domains {
124
Events<?, ?> events();
125
Javascript<?, ?> javascript();
126
Network<?, ?> network();
127
Target target();
128
Log log();
129
130
/**
131
* Disables events, javascript, and network domains
132
* Deliberately does not disable targets or log
133
*/
134
default void disableAll();
135
}
136
```
137
138
## Dependencies
139
140
### Required Selenium Classes
141
142
```java { .api }
143
// Core DevTools classes
144
class DevTools { ... }
145
146
// Idealized interfaces
147
interface Events<ConsoleEvent, ExceptionEvent> { ... }
148
interface Javascript<ScriptId, BindingEvent> { ... }
149
interface Network<AuthEvent, RequestEvent> { ... }
150
interface Target { ... }
151
interface Log { ... }
152
153
// Base CDP info class
154
abstract class CdpInfo { ... }
155
```
156
157
### Service Discovery
158
159
```java { .api }
160
// Google Auto Service annotation for automatic registration
161
@AutoService(CdpInfo.class)
162
```
163
164
The domain management system uses Google's AutoService for automatic service discovery, allowing the Selenium framework to automatically detect and register v102 CDP support without manual configuration.