cdp-driver 0.3.0

Chrome DevTools Protocol client for AI agent browser control
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! This domain emulates different environments for the page.
//!
//! Method names for the `Emulation` domain, for use with
//! [`CdpClient::call`](crate::CdpClient::call).

/// Tells whether emulation is supported.
///
/// Deprecated in the protocol.
///
/// Returns: `result`
pub const CAN_EMULATE: &str = "Emulation.canEmulate";

/// Clears the overridden device metrics.
pub const CLEAR_DEVICE_METRICS_OVERRIDE: &str = "Emulation.clearDeviceMetricsOverride";

/// Clears the overridden Geolocation Position and Error.
pub const CLEAR_GEOLOCATION_OVERRIDE: &str = "Emulation.clearGeolocationOverride";

/// Requests that page scale factor is reset to initial values.
///
/// Experimental: may change without notice.
pub const RESET_PAGE_SCALE_FACTOR: &str = "Emulation.resetPageScaleFactor";

/// Enables or disables simulating a focused and active page.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `enabled`: boolean
pub const SET_FOCUS_EMULATION_ENABLED: &str = "Emulation.setFocusEmulationEnabled";

/// Automatically render all web contents using a dark theme.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `enabled`: boolean (optional)
pub const SET_AUTO_DARK_MODE_OVERRIDE: &str = "Emulation.setAutoDarkModeOverride";

/// Enables CPU throttling to emulate slow CPUs.
///
/// Parameters:
/// - `rate`: number
pub const SET_CPU_THROTTLING_RATE: &str = "Emulation.setCPUThrottlingRate";

/// Sets or clears an override of the default background color of the frame.
/// This override is used if the content does not specify one.
///
/// Parameters:
/// - `color`: DOM.RGBA (optional)
pub const SET_DEFAULT_BACKGROUND_COLOR_OVERRIDE: &str =
    "Emulation.setDefaultBackgroundColorOverride";

/// Overrides the values for env(safe-area-inset-*) and
/// env(safe-area-max-inset-*). Unset values will cause the respective
/// variables to be undefined, even if previously overridden.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `insets`: SafeAreaInsets
pub const SET_SAFE_AREA_INSETS_OVERRIDE: &str = "Emulation.setSafeAreaInsetsOverride";

/// Overrides the values of device screen dimensions (window.screen.width,
/// window.screen.height, window.innerWidth, window.innerHeight, and
/// "device-width"/"device-height"-related CSS media query results).
///
/// Parameters:
/// - `width`: integer
/// - `height`: integer
/// - `deviceScaleFactor`: number
/// - `mobile`: boolean
/// - `scale`: number (optional)
/// - `screenWidth`: integer (optional)
/// - `screenHeight`: integer (optional)
/// - `positionX`: integer (optional)
/// - `positionY`: integer (optional)
/// - `dontSetVisibleSize`: boolean (optional)
/// - `screenOrientation`: ScreenOrientation (optional)
/// - `viewport`: Page.Viewport (optional)
/// - `displayFeature`: DisplayFeature (optional)
/// - `devicePosture`: DevicePosture (optional)
/// - `scrollbarType`: string (optional)
/// - `screenOrientationLockEmulation`: boolean (optional)
pub const SET_DEVICE_METRICS_OVERRIDE: &str = "Emulation.setDeviceMetricsOverride";

/// Start reporting the given posture value to the Device Posture API. This
/// override can also be set in setDeviceMetricsOverride().
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `posture`: DevicePosture
pub const SET_DEVICE_POSTURE_OVERRIDE: &str = "Emulation.setDevicePostureOverride";

/// Clears a device posture override set with either
/// setDeviceMetricsOverride() or setDevicePostureOverride() and starts using
/// posture information from the platform again. Does nothing if no override
/// is set.
///
/// Experimental: may change without notice.
pub const CLEAR_DEVICE_POSTURE_OVERRIDE: &str = "Emulation.clearDevicePostureOverride";

/// Start using the given display features to pupulate the Viewport Segments
/// API. This override can also be set in setDeviceMetricsOverride().
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `features`: array
pub const SET_DISPLAY_FEATURES_OVERRIDE: &str = "Emulation.setDisplayFeaturesOverride";

/// Clears the display features override set with either
/// setDeviceMetricsOverride() or setDisplayFeaturesOverride() and starts
/// using display features from the platform again. Does nothing if no
/// override is set.
///
/// Experimental: may change without notice.
pub const CLEAR_DISPLAY_FEATURES_OVERRIDE: &str = "Emulation.clearDisplayFeaturesOverride";

/// `Emulation.setScrollbarsHidden`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `hidden`: boolean
pub const SET_SCROLLBARS_HIDDEN: &str = "Emulation.setScrollbarsHidden";

/// `Emulation.setDocumentCookieDisabled`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `disabled`: boolean
pub const SET_DOCUMENT_COOKIE_DISABLED: &str = "Emulation.setDocumentCookieDisabled";

/// `Emulation.setEmitTouchEventsForMouse`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `enabled`: boolean
/// - `configuration`: string (optional)
pub const SET_EMIT_TOUCH_EVENTS_FOR_MOUSE: &str = "Emulation.setEmitTouchEventsForMouse";

/// Emulates the given media type or media feature for CSS media queries.
///
/// Parameters:
/// - `media`: string (optional)
/// - `features`: array (optional)
pub const SET_EMULATED_MEDIA: &str = "Emulation.setEmulatedMedia";

/// Emulates the given vision deficiency.
///
/// Parameters:
/// - `type`: string
pub const SET_EMULATED_VISION_DEFICIENCY: &str = "Emulation.setEmulatedVisionDeficiency";

/// Emulates the given OS text scale.
///
/// Parameters:
/// - `scale`: number (optional)
pub const SET_EMULATED_OS_TEXT_SCALE: &str = "Emulation.setEmulatedOSTextScale";

/// Overrides the Geolocation Position or Error. Omitting latitude, longitude
/// or accuracy emulates position unavailable.
///
/// Parameters:
/// - `latitude`: number (optional)
/// - `longitude`: number (optional)
/// - `accuracy`: number (optional)
/// - `altitude`: number (optional)
/// - `altitudeAccuracy`: number (optional)
/// - `heading`: number (optional)
/// - `speed`: number (optional)
pub const SET_GEOLOCATION_OVERRIDE: &str = "Emulation.setGeolocationOverride";

/// `Emulation.getOverriddenSensorInformation`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `type`: SensorType
///
/// Returns: `requestedSamplingFrequency`
pub const GET_OVERRIDDEN_SENSOR_INFORMATION: &str = "Emulation.getOverriddenSensorInformation";

/// Overrides a platform sensor of a given type. If |enabled| is true, calls
/// to Sensor.start() will use a virtual sensor as backend rather than
/// fetching data from a real hardware sensor. Otherwise, existing virtual
/// sensor-backend Sensor objects will fire an error event and new calls to
/// Sensor.start() will attempt to use a real sensor instead.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `enabled`: boolean
/// - `type`: SensorType
/// - `metadata`: SensorMetadata (optional)
pub const SET_SENSOR_OVERRIDE_ENABLED: &str = "Emulation.setSensorOverrideEnabled";

/// Updates the sensor readings reported by a sensor type previously
/// overridden by setSensorOverrideEnabled.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `type`: SensorType
/// - `reading`: SensorReading
pub const SET_SENSOR_OVERRIDE_READINGS: &str = "Emulation.setSensorOverrideReadings";

/// Overrides a pressure source of a given type, as used by the Compute
/// Pressure API, so that updates to PressureObserver.observe() are provided
/// via setPressureStateOverride instead of being retrieved from
/// platform-provided telemetry data.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `enabled`: boolean
/// - `source`: PressureSource
/// - `metadata`: PressureMetadata (optional)
pub const SET_PRESSURE_SOURCE_OVERRIDE_ENABLED: &str = "Emulation.setPressureSourceOverrideEnabled";

/// Provides a given pressure state that will be processed and eventually be
/// delivered to PressureObserver users. |source| must have been previously
/// overridden by setPressureSourceOverrideEnabled.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `source`: PressureSource
/// - `state`: PressureState
pub const SET_PRESSURE_STATE_OVERRIDE: &str = "Emulation.setPressureStateOverride";

/// Overrides the Idle state.
///
/// Parameters:
/// - `isUserActive`: boolean
/// - `isScreenUnlocked`: boolean
pub const SET_IDLE_OVERRIDE: &str = "Emulation.setIdleOverride";

/// Clears Idle state overrides.
pub const CLEAR_IDLE_OVERRIDE: &str = "Emulation.clearIdleOverride";

/// Overrides value returned by the javascript navigator object.
///
/// Deprecated in the protocol.
/// Experimental: may change without notice.
///
/// Parameters:
/// - `platform`: string
pub const SET_NAVIGATOR_OVERRIDES: &str = "Emulation.setNavigatorOverrides";

/// Sets a specified page scale factor.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `pageScaleFactor`: number
pub const SET_PAGE_SCALE_FACTOR: &str = "Emulation.setPageScaleFactor";

/// Switches script execution in the page.
///
/// Parameters:
/// - `value`: boolean
pub const SET_SCRIPT_EXECUTION_DISABLED: &str = "Emulation.setScriptExecutionDisabled";

/// Enables touch on platforms which do not support them.
///
/// Parameters:
/// - `enabled`: boolean
/// - `maxTouchPoints`: integer (optional)
pub const SET_TOUCH_EMULATION_ENABLED: &str = "Emulation.setTouchEmulationEnabled";

/// Turns on virtual time for all frames (replacing real-time with a synthetic
/// time source) and sets the current virtual time policy. Note this
/// supersedes any previous time budget.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `policy`: VirtualTimePolicy
/// - `budget`: number (optional)
/// - `maxVirtualTimeTaskStarvationCount`: integer (optional)
/// - `initialVirtualTime`: Network.TimeSinceEpoch (optional)
///
/// Returns: `virtualTimeTicksBase`
pub const SET_VIRTUAL_TIME_POLICY: &str = "Emulation.setVirtualTimePolicy";

/// Overrides default host system locale with the specified one.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `locale`: string (optional)
pub const SET_LOCALE_OVERRIDE: &str = "Emulation.setLocaleOverride";

/// Overrides default host system timezone with the specified one.
///
/// Parameters:
/// - `timezoneId`: string
pub const SET_TIMEZONE_OVERRIDE: &str = "Emulation.setTimezoneOverride";

/// Resizes the frame/viewport of the page. Note that this does not affect the
/// frame's container (e.g. browser window). Can be used to produce
/// screenshots of the specified size. Not supported on Android.
///
/// Deprecated in the protocol.
/// Experimental: may change without notice.
///
/// Parameters:
/// - `width`: integer
/// - `height`: integer
pub const SET_VISIBLE_SIZE: &str = "Emulation.setVisibleSize";

/// `Emulation.setDisabledImageTypes`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `imageTypes`: array
pub const SET_DISABLED_IMAGE_TYPES: &str = "Emulation.setDisabledImageTypes";

/// Override the value of navigator.connection.saveData
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `dataSaverEnabled`: boolean (optional)
pub const SET_DATA_SAVER_OVERRIDE: &str = "Emulation.setDataSaverOverride";

/// `Emulation.setHardwareConcurrencyOverride`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `hardwareConcurrency`: integer
pub const SET_HARDWARE_CONCURRENCY_OVERRIDE: &str = "Emulation.setHardwareConcurrencyOverride";

/// Allows overriding user agent with the given string. `userAgentMetadata`
/// must be set for Client Hint headers to be sent.
///
/// Parameters:
/// - `userAgent`: string
/// - `acceptLanguage`: string (optional)
/// - `platform`: string (optional)
/// - `userAgentMetadata`: UserAgentMetadata (optional)
pub const SET_USER_AGENT_OVERRIDE: &str = "Emulation.setUserAgentOverride";

/// Allows overriding the automation flag.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `enabled`: boolean
pub const SET_AUTOMATION_OVERRIDE: &str = "Emulation.setAutomationOverride";

/// Allows overriding the difference between the small and large viewport
/// sizes, which determine the value of the `svh` and `lvh` unit,
/// respectively. Only supported for top-level frames.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `difference`: integer
pub const SET_SMALL_VIEWPORT_HEIGHT_DIFFERENCE_OVERRIDE: &str =
    "Emulation.setSmallViewportHeightDifferenceOverride";

/// Returns device's screen configuration. In headful mode, the physical
/// screens configuration is returned, whereas in headless mode, a virtual
/// headless screen configuration is provided instead.
///
/// Experimental: may change without notice.
///
/// Returns: `screenInfos`
pub const GET_SCREEN_INFOS: &str = "Emulation.getScreenInfos";

/// Add a new screen to the device. Only supported in headless mode.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `left`: integer
/// - `top`: integer
/// - `width`: integer
/// - `height`: integer
/// - `workAreaInsets`: WorkAreaInsets (optional)
/// - `devicePixelRatio`: number (optional)
/// - `rotation`: integer (optional)
/// - `colorDepth`: integer (optional)
/// - `label`: string (optional)
/// - `isInternal`: boolean (optional)
///
/// Returns: `screenInfo`
pub const ADD_SCREEN: &str = "Emulation.addScreen";

/// Updates specified screen parameters. Only supported in headless mode.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `screenId`: ScreenId
/// - `left`: integer (optional)
/// - `top`: integer (optional)
/// - `width`: integer (optional)
/// - `height`: integer (optional)
/// - `workAreaInsets`: WorkAreaInsets (optional)
/// - `devicePixelRatio`: number (optional)
/// - `rotation`: integer (optional)
/// - `colorDepth`: integer (optional)
/// - `label`: string (optional)
/// - `isInternal`: boolean (optional)
///
/// Returns: `screenInfo`
pub const UPDATE_SCREEN: &str = "Emulation.updateScreen";

/// Remove screen from the device. Only supported in headless mode.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `screenId`: ScreenId
pub const REMOVE_SCREEN: &str = "Emulation.removeScreen";

/// Set primary screen. Only supported in headless mode. Note that this
/// changes the coordinate system origin to the top-left of the new primary
/// screen, updating the bounds and work areas of all existing screens
/// accordingly.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `screenId`: ScreenId
pub const SET_PRIMARY_SCREEN: &str = "Emulation.setPrimaryScreen";