Skip to main content

Module emulation

Module emulation 

Source
Expand description

This domain emulates different environments for the page.

Method names for the Emulation domain, for use with CdpClient::call.

Constants§

ADD_SCREEN
Add a new screen to the device. Only supported in headless mode.
CAN_EMULATE
Tells whether emulation is supported.
CLEAR_DEVICE_METRICS_OVERRIDE
Clears the overridden device metrics.
CLEAR_DEVICE_POSTURE_OVERRIDE
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.
CLEAR_DISPLAY_FEATURES_OVERRIDE
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.
CLEAR_GEOLOCATION_OVERRIDE
Clears the overridden Geolocation Position and Error.
CLEAR_IDLE_OVERRIDE
Clears Idle state overrides.
GET_OVERRIDDEN_SENSOR_INFORMATION
Emulation.getOverriddenSensorInformation
GET_SCREEN_INFOS
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.
REMOVE_SCREEN
Remove screen from the device. Only supported in headless mode.
RESET_PAGE_SCALE_FACTOR
Requests that page scale factor is reset to initial values.
SET_AUTOMATION_OVERRIDE
Allows overriding the automation flag.
SET_AUTO_DARK_MODE_OVERRIDE
Automatically render all web contents using a dark theme.
SET_CPU_PERFORMANCE_OVERRIDE
Overrides the value of navigator.cpuPerformance
SET_CPU_THROTTLING_RATE
Enables CPU throttling to emulate slow CPUs.
SET_DATA_SAVER_OVERRIDE
Override the value of navigator.connection.saveData
SET_DEFAULT_BACKGROUND_COLOR_OVERRIDE
Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.
SET_DEVICE_METRICS_OVERRIDE
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).
SET_DEVICE_POSTURE_OVERRIDE
Start reporting the given posture value to the Device Posture API. This override can also be set in setDeviceMetricsOverride().
SET_DISABLED_IMAGE_TYPES
Emulation.setDisabledImageTypes
SET_DISPLAY_FEATURES_OVERRIDE
Start using the given display features to pupulate the Viewport Segments API. This override can also be set in setDeviceMetricsOverride().
SET_DOCUMENT_COOKIE_DISABLED
Emulation.setDocumentCookieDisabled
SET_EMIT_TOUCH_EVENTS_FOR_MOUSE
Emulation.setEmitTouchEventsForMouse
SET_EMULATED_MEDIA
Emulates the given media type or media feature for CSS media queries.
SET_EMULATED_OS_TEXT_SCALE
Emulates the given OS text scale.
SET_EMULATED_VISION_DEFICIENCY
Emulates the given vision deficiency.
SET_FOCUS_EMULATION_ENABLED
Enables or disables simulating a focused and active page.
SET_GEOLOCATION_OVERRIDE
Overrides the Geolocation Position or Error. Omitting latitude, longitude or accuracy emulates position unavailable.
SET_HARDWARE_CONCURRENCY_OVERRIDE
Emulation.setHardwareConcurrencyOverride
SET_IDLE_OVERRIDE
Overrides the Idle state.
SET_LOCALE_OVERRIDE
Overrides default host system locale with the specified one.
SET_NAVIGATOR_OVERRIDES
Overrides value returned by the javascript navigator object.
SET_PAGE_SCALE_FACTOR
Sets a specified page scale factor.
SET_PRESSURE_SOURCE_OVERRIDE_ENABLED
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.
SET_PRESSURE_STATE_OVERRIDE
Provides a given pressure state that will be processed and eventually be delivered to PressureObserver users. |source| must have been previously overridden by setPressureSourceOverrideEnabled.
SET_PRIMARY_SCREEN
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.
SET_SAFE_AREA_INSETS_OVERRIDE
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.
SET_SCRIPT_EXECUTION_DISABLED
Switches script execution in the page.
SET_SCROLLBARS_HIDDEN
Emulation.setScrollbarsHidden
SET_SENSOR_OVERRIDE_ENABLED
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.
SET_SENSOR_OVERRIDE_READINGS
Updates the sensor readings reported by a sensor type previously overridden by setSensorOverrideEnabled.
SET_SMALL_VIEWPORT_HEIGHT_DIFFERENCE_OVERRIDE
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.
SET_TIMEZONE_OVERRIDE
Overrides default host system timezone with the specified one.
SET_TOUCH_EMULATION_ENABLED
Enables touch on platforms which do not support them.
SET_USER_AGENT_OVERRIDE
Allows overriding user agent with the given string. userAgentMetadata must be set for Client Hint headers to be sent.
SET_VIRTUAL_KEYBOARD_GEOMETRY_OVERRIDE
Overrides virtual keyboard geometry in CSS pixels, relative to the top-level viewport. The provided rect is used for navigator.virtualKeyboard.boundingRect, geometrychange events, and env(keyboard-inset-*) values on the inspected frame. The override applies independently of navigator.virtualKeyboard.overlaysContent so clients can preview overlay geometry without mutating page state. Values are rounded to the nearest CSS pixel. Omitting the rect clears the override.
SET_VIRTUAL_TIME_POLICY
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.
SET_VISIBLE_SIZE
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.
UPDATE_SCREEN
Updates specified screen parameters. Only supported in headless mode.