Skip to main content

cdp_driver/methods/
emulation.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! This domain emulates different environments for the page.
5//!
6//! Method names for the `Emulation` domain, for use with
7//! [`CdpClient::call`](crate::CdpClient::call).
8
9/// Tells whether emulation is supported.
10///
11/// Deprecated in the protocol.
12///
13/// Returns: `result`
14pub const CAN_EMULATE: &str = "Emulation.canEmulate";
15
16/// Clears the overridden device metrics.
17pub const CLEAR_DEVICE_METRICS_OVERRIDE: &str = "Emulation.clearDeviceMetricsOverride";
18
19/// Clears the overridden Geolocation Position and Error.
20pub const CLEAR_GEOLOCATION_OVERRIDE: &str = "Emulation.clearGeolocationOverride";
21
22/// Requests that page scale factor is reset to initial values.
23///
24/// Experimental: may change without notice.
25pub const RESET_PAGE_SCALE_FACTOR: &str = "Emulation.resetPageScaleFactor";
26
27/// Enables or disables simulating a focused and active page.
28///
29/// Experimental: may change without notice.
30///
31/// Parameters:
32/// - `enabled`: boolean
33pub const SET_FOCUS_EMULATION_ENABLED: &str = "Emulation.setFocusEmulationEnabled";
34
35/// Automatically render all web contents using a dark theme.
36///
37/// Experimental: may change without notice.
38///
39/// Parameters:
40/// - `enabled`: boolean (optional)
41pub const SET_AUTO_DARK_MODE_OVERRIDE: &str = "Emulation.setAutoDarkModeOverride";
42
43/// Enables CPU throttling to emulate slow CPUs.
44///
45/// Parameters:
46/// - `rate`: number
47pub const SET_CPU_THROTTLING_RATE: &str = "Emulation.setCPUThrottlingRate";
48
49/// Sets or clears an override of the default background color of the frame.
50/// This override is used if the content does not specify one.
51///
52/// Parameters:
53/// - `color`: DOM.RGBA (optional)
54pub const SET_DEFAULT_BACKGROUND_COLOR_OVERRIDE: &str =
55    "Emulation.setDefaultBackgroundColorOverride";
56
57/// Overrides the values for env(safe-area-inset-*) and
58/// env(safe-area-max-inset-*). Unset values will cause the respective
59/// variables to be undefined, even if previously overridden.
60///
61/// Experimental: may change without notice.
62///
63/// Parameters:
64/// - `insets`: SafeAreaInsets
65pub const SET_SAFE_AREA_INSETS_OVERRIDE: &str = "Emulation.setSafeAreaInsetsOverride";
66
67/// Overrides the values of device screen dimensions (window.screen.width,
68/// window.screen.height, window.innerWidth, window.innerHeight, and
69/// "device-width"/"device-height"-related CSS media query results).
70///
71/// Parameters:
72/// - `width`: integer
73/// - `height`: integer
74/// - `deviceScaleFactor`: number
75/// - `mobile`: boolean
76/// - `scale`: number (optional)
77/// - `screenWidth`: integer (optional)
78/// - `screenHeight`: integer (optional)
79/// - `positionX`: integer (optional)
80/// - `positionY`: integer (optional)
81/// - `dontSetVisibleSize`: boolean (optional)
82/// - `screenOrientation`: ScreenOrientation (optional)
83/// - `viewport`: Page.Viewport (optional)
84/// - `displayFeature`: DisplayFeature (optional)
85/// - `devicePosture`: DevicePosture (optional)
86/// - `scrollbarType`: string (optional)
87/// - `screenOrientationLockEmulation`: boolean (optional)
88pub const SET_DEVICE_METRICS_OVERRIDE: &str = "Emulation.setDeviceMetricsOverride";
89
90/// Start reporting the given posture value to the Device Posture API. This
91/// override can also be set in setDeviceMetricsOverride().
92///
93/// Experimental: may change without notice.
94///
95/// Parameters:
96/// - `posture`: DevicePosture
97pub const SET_DEVICE_POSTURE_OVERRIDE: &str = "Emulation.setDevicePostureOverride";
98
99/// Clears a device posture override set with either
100/// setDeviceMetricsOverride() or setDevicePostureOverride() and starts using
101/// posture information from the platform again. Does nothing if no override
102/// is set.
103///
104/// Experimental: may change without notice.
105pub const CLEAR_DEVICE_POSTURE_OVERRIDE: &str = "Emulation.clearDevicePostureOverride";
106
107/// Start using the given display features to pupulate the Viewport Segments
108/// API. This override can also be set in setDeviceMetricsOverride().
109///
110/// Experimental: may change without notice.
111///
112/// Parameters:
113/// - `features`: array
114pub const SET_DISPLAY_FEATURES_OVERRIDE: &str = "Emulation.setDisplayFeaturesOverride";
115
116/// Clears the display features override set with either
117/// setDeviceMetricsOverride() or setDisplayFeaturesOverride() and starts
118/// using display features from the platform again. Does nothing if no
119/// override is set.
120///
121/// Experimental: may change without notice.
122pub const CLEAR_DISPLAY_FEATURES_OVERRIDE: &str = "Emulation.clearDisplayFeaturesOverride";
123
124/// `Emulation.setScrollbarsHidden`
125///
126/// Experimental: may change without notice.
127///
128/// Parameters:
129/// - `hidden`: boolean
130pub const SET_SCROLLBARS_HIDDEN: &str = "Emulation.setScrollbarsHidden";
131
132/// `Emulation.setDocumentCookieDisabled`
133///
134/// Experimental: may change without notice.
135///
136/// Parameters:
137/// - `disabled`: boolean
138pub const SET_DOCUMENT_COOKIE_DISABLED: &str = "Emulation.setDocumentCookieDisabled";
139
140/// `Emulation.setEmitTouchEventsForMouse`
141///
142/// Experimental: may change without notice.
143///
144/// Parameters:
145/// - `enabled`: boolean
146/// - `configuration`: string (optional)
147pub const SET_EMIT_TOUCH_EVENTS_FOR_MOUSE: &str = "Emulation.setEmitTouchEventsForMouse";
148
149/// Emulates the given media type or media feature for CSS media queries.
150///
151/// Parameters:
152/// - `media`: string (optional)
153/// - `features`: array (optional)
154pub const SET_EMULATED_MEDIA: &str = "Emulation.setEmulatedMedia";
155
156/// Emulates the given vision deficiency.
157///
158/// Parameters:
159/// - `type`: string
160pub const SET_EMULATED_VISION_DEFICIENCY: &str = "Emulation.setEmulatedVisionDeficiency";
161
162/// Emulates the given OS text scale.
163///
164/// Parameters:
165/// - `scale`: number (optional)
166pub const SET_EMULATED_OS_TEXT_SCALE: &str = "Emulation.setEmulatedOSTextScale";
167
168/// Overrides the Geolocation Position or Error. Omitting latitude, longitude
169/// or accuracy emulates position unavailable.
170///
171/// Parameters:
172/// - `latitude`: number (optional)
173/// - `longitude`: number (optional)
174/// - `accuracy`: number (optional)
175/// - `altitude`: number (optional)
176/// - `altitudeAccuracy`: number (optional)
177/// - `heading`: number (optional)
178/// - `speed`: number (optional)
179pub const SET_GEOLOCATION_OVERRIDE: &str = "Emulation.setGeolocationOverride";
180
181/// `Emulation.getOverriddenSensorInformation`
182///
183/// Experimental: may change without notice.
184///
185/// Parameters:
186/// - `type`: SensorType
187///
188/// Returns: `requestedSamplingFrequency`
189pub const GET_OVERRIDDEN_SENSOR_INFORMATION: &str = "Emulation.getOverriddenSensorInformation";
190
191/// Overrides a platform sensor of a given type. If |enabled| is true, calls
192/// to Sensor.start() will use a virtual sensor as backend rather than
193/// fetching data from a real hardware sensor. Otherwise, existing virtual
194/// sensor-backend Sensor objects will fire an error event and new calls to
195/// Sensor.start() will attempt to use a real sensor instead.
196///
197/// Experimental: may change without notice.
198///
199/// Parameters:
200/// - `enabled`: boolean
201/// - `type`: SensorType
202/// - `metadata`: SensorMetadata (optional)
203pub const SET_SENSOR_OVERRIDE_ENABLED: &str = "Emulation.setSensorOverrideEnabled";
204
205/// Updates the sensor readings reported by a sensor type previously
206/// overridden by setSensorOverrideEnabled.
207///
208/// Experimental: may change without notice.
209///
210/// Parameters:
211/// - `type`: SensorType
212/// - `reading`: SensorReading
213pub const SET_SENSOR_OVERRIDE_READINGS: &str = "Emulation.setSensorOverrideReadings";
214
215/// Overrides a pressure source of a given type, as used by the Compute
216/// Pressure API, so that updates to PressureObserver.observe() are provided
217/// via setPressureStateOverride instead of being retrieved from
218/// platform-provided telemetry data.
219///
220/// Experimental: may change without notice.
221///
222/// Parameters:
223/// - `enabled`: boolean
224/// - `source`: PressureSource
225/// - `metadata`: PressureMetadata (optional)
226pub const SET_PRESSURE_SOURCE_OVERRIDE_ENABLED: &str = "Emulation.setPressureSourceOverrideEnabled";
227
228/// Provides a given pressure state that will be processed and eventually be
229/// delivered to PressureObserver users. |source| must have been previously
230/// overridden by setPressureSourceOverrideEnabled.
231///
232/// Experimental: may change without notice.
233///
234/// Parameters:
235/// - `source`: PressureSource
236/// - `state`: PressureState
237pub const SET_PRESSURE_STATE_OVERRIDE: &str = "Emulation.setPressureStateOverride";
238
239/// Overrides the Idle state.
240///
241/// Parameters:
242/// - `isUserActive`: boolean
243/// - `isScreenUnlocked`: boolean
244pub const SET_IDLE_OVERRIDE: &str = "Emulation.setIdleOverride";
245
246/// Clears Idle state overrides.
247pub const CLEAR_IDLE_OVERRIDE: &str = "Emulation.clearIdleOverride";
248
249/// Overrides value returned by the javascript navigator object.
250///
251/// Deprecated in the protocol.
252/// Experimental: may change without notice.
253///
254/// Parameters:
255/// - `platform`: string
256pub const SET_NAVIGATOR_OVERRIDES: &str = "Emulation.setNavigatorOverrides";
257
258/// Sets a specified page scale factor.
259///
260/// Experimental: may change without notice.
261///
262/// Parameters:
263/// - `pageScaleFactor`: number
264pub const SET_PAGE_SCALE_FACTOR: &str = "Emulation.setPageScaleFactor";
265
266/// Switches script execution in the page.
267///
268/// Parameters:
269/// - `value`: boolean
270pub const SET_SCRIPT_EXECUTION_DISABLED: &str = "Emulation.setScriptExecutionDisabled";
271
272/// Enables touch on platforms which do not support them.
273///
274/// Parameters:
275/// - `enabled`: boolean
276/// - `maxTouchPoints`: integer (optional)
277pub const SET_TOUCH_EMULATION_ENABLED: &str = "Emulation.setTouchEmulationEnabled";
278
279/// Turns on virtual time for all frames (replacing real-time with a synthetic
280/// time source) and sets the current virtual time policy. Note this
281/// supersedes any previous time budget.
282///
283/// Experimental: may change without notice.
284///
285/// Parameters:
286/// - `policy`: VirtualTimePolicy
287/// - `budget`: number (optional)
288/// - `maxVirtualTimeTaskStarvationCount`: integer (optional)
289/// - `initialVirtualTime`: Network.TimeSinceEpoch (optional)
290///
291/// Returns: `virtualTimeTicksBase`
292pub const SET_VIRTUAL_TIME_POLICY: &str = "Emulation.setVirtualTimePolicy";
293
294/// Overrides default host system locale with the specified one.
295///
296/// Experimental: may change without notice.
297///
298/// Parameters:
299/// - `locale`: string (optional)
300pub const SET_LOCALE_OVERRIDE: &str = "Emulation.setLocaleOverride";
301
302/// Overrides default host system timezone with the specified one.
303///
304/// Parameters:
305/// - `timezoneId`: string
306pub const SET_TIMEZONE_OVERRIDE: &str = "Emulation.setTimezoneOverride";
307
308/// Resizes the frame/viewport of the page. Note that this does not affect the
309/// frame's container (e.g. browser window). Can be used to produce
310/// screenshots of the specified size. Not supported on Android.
311///
312/// Deprecated in the protocol.
313/// Experimental: may change without notice.
314///
315/// Parameters:
316/// - `width`: integer
317/// - `height`: integer
318pub const SET_VISIBLE_SIZE: &str = "Emulation.setVisibleSize";
319
320/// `Emulation.setDisabledImageTypes`
321///
322/// Experimental: may change without notice.
323///
324/// Parameters:
325/// - `imageTypes`: array
326pub const SET_DISABLED_IMAGE_TYPES: &str = "Emulation.setDisabledImageTypes";
327
328/// Override the value of navigator.connection.saveData
329///
330/// Experimental: may change without notice.
331///
332/// Parameters:
333/// - `dataSaverEnabled`: boolean (optional)
334pub const SET_DATA_SAVER_OVERRIDE: &str = "Emulation.setDataSaverOverride";
335
336/// `Emulation.setHardwareConcurrencyOverride`
337///
338/// Experimental: may change without notice.
339///
340/// Parameters:
341/// - `hardwareConcurrency`: integer
342pub const SET_HARDWARE_CONCURRENCY_OVERRIDE: &str = "Emulation.setHardwareConcurrencyOverride";
343
344/// Allows overriding user agent with the given string. `userAgentMetadata`
345/// must be set for Client Hint headers to be sent.
346///
347/// Parameters:
348/// - `userAgent`: string
349/// - `acceptLanguage`: string (optional)
350/// - `platform`: string (optional)
351/// - `userAgentMetadata`: UserAgentMetadata (optional)
352pub const SET_USER_AGENT_OVERRIDE: &str = "Emulation.setUserAgentOverride";
353
354/// Allows overriding the automation flag.
355///
356/// Experimental: may change without notice.
357///
358/// Parameters:
359/// - `enabled`: boolean
360pub const SET_AUTOMATION_OVERRIDE: &str = "Emulation.setAutomationOverride";
361
362/// Allows overriding the difference between the small and large viewport
363/// sizes, which determine the value of the `svh` and `lvh` unit,
364/// respectively. Only supported for top-level frames.
365///
366/// Experimental: may change without notice.
367///
368/// Parameters:
369/// - `difference`: integer
370pub const SET_SMALL_VIEWPORT_HEIGHT_DIFFERENCE_OVERRIDE: &str =
371    "Emulation.setSmallViewportHeightDifferenceOverride";
372
373/// Returns device's screen configuration. In headful mode, the physical
374/// screens configuration is returned, whereas in headless mode, a virtual
375/// headless screen configuration is provided instead.
376///
377/// Experimental: may change without notice.
378///
379/// Returns: `screenInfos`
380pub const GET_SCREEN_INFOS: &str = "Emulation.getScreenInfos";
381
382/// Add a new screen to the device. Only supported in headless mode.
383///
384/// Experimental: may change without notice.
385///
386/// Parameters:
387/// - `left`: integer
388/// - `top`: integer
389/// - `width`: integer
390/// - `height`: integer
391/// - `workAreaInsets`: WorkAreaInsets (optional)
392/// - `devicePixelRatio`: number (optional)
393/// - `rotation`: integer (optional)
394/// - `colorDepth`: integer (optional)
395/// - `label`: string (optional)
396/// - `isInternal`: boolean (optional)
397///
398/// Returns: `screenInfo`
399pub const ADD_SCREEN: &str = "Emulation.addScreen";
400
401/// Updates specified screen parameters. Only supported in headless mode.
402///
403/// Experimental: may change without notice.
404///
405/// Parameters:
406/// - `screenId`: ScreenId
407/// - `left`: integer (optional)
408/// - `top`: integer (optional)
409/// - `width`: integer (optional)
410/// - `height`: integer (optional)
411/// - `workAreaInsets`: WorkAreaInsets (optional)
412/// - `devicePixelRatio`: number (optional)
413/// - `rotation`: integer (optional)
414/// - `colorDepth`: integer (optional)
415/// - `label`: string (optional)
416/// - `isInternal`: boolean (optional)
417///
418/// Returns: `screenInfo`
419pub const UPDATE_SCREEN: &str = "Emulation.updateScreen";
420
421/// Remove screen from the device. Only supported in headless mode.
422///
423/// Experimental: may change without notice.
424///
425/// Parameters:
426/// - `screenId`: ScreenId
427pub const REMOVE_SCREEN: &str = "Emulation.removeScreen";
428
429/// Set primary screen. Only supported in headless mode. Note that this
430/// changes the coordinate system origin to the top-left of the new primary
431/// screen, updating the bounds and work areas of all existing screens
432/// accordingly.
433///
434/// Experimental: may change without notice.
435///
436/// Parameters:
437/// - `screenId`: ScreenId
438pub const SET_PRIMARY_SCREEN: &str = "Emulation.setPrimaryScreen";