Skip to main content

Module emulation

Module emulation 

Source
Expand description

This domain emulates different environments for the page.

Types, command parameters and event payloads for the Emulation domain. The method-name constants for the same domain are in crate::methods.

Structs§

AddScreenParams
Add a new screen to the device. Only supported in headless mode.
AddScreenReturns
What Emulation.addScreen answers with.
CanEmulateParams
Tells whether emulation is supported.
CanEmulateReturns
What Emulation.canEmulate answers with.
ClearDeviceMetricsOverrideParams
Clears the overridden device metrics.
ClearDevicePostureOverrideParams
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.
ClearDisplayFeaturesOverrideParams
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.
ClearGeolocationOverrideParams
Clears the overridden Geolocation Position and Error.
ClearIdleOverrideParams
Clears Idle state overrides.
DevicePosture
DisplayFeature
GetOverriddenSensorInformationParams
Experimental: may change without notice.
GetOverriddenSensorInformationReturns
What Emulation.getOverriddenSensorInformation answers with.
GetScreenInfosParams
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.
GetScreenInfosReturns
What Emulation.getScreenInfos answers with.
MediaFeature
PressureMetadata
Experimental: may change without notice.
RemoveScreenParams
Remove screen from the device. Only supported in headless mode.
ResetPageScaleFactorParams
Requests that page scale factor is reset to initial values.
SafeAreaInsets
Experimental: may change without notice.
ScreenInfo
Screen information similar to the one returned by window.getScreenDetails() method, see https://w3c.github.io/window-management/#screendetailed.
ScreenOrientation
Screen orientation.
ScreenOrientationLockChangedEvent
Fired when a page calls screen.orientation.lock() or screen.orientation.unlock() while device emulation is enabled. This allows the DevTools frontend to update the emulated device orientation accordingly.
SensorMetadata
Experimental: may change without notice.
SensorReading
Experimental: may change without notice.
SensorReadingQuaternion
Experimental: may change without notice.
SensorReadingSingle
Experimental: may change without notice.
SensorReadingXyz
Experimental: may change without notice.
SetAutoDarkModeOverrideParams
Automatically render all web contents using a dark theme.
SetAutomationOverrideParams
Allows overriding the automation flag.
SetCpuPerformanceOverrideParams
Overrides the value of navigator.cpuPerformance
SetCpuThrottlingRateParams
Enables CPU throttling to emulate slow CPUs.
SetDataSaverOverrideParams
Override the value of navigator.connection.saveData
SetDefaultBackgroundColorOverrideParams
Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.
SetDeviceMetricsOverrideParams
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).
SetDevicePostureOverrideParams
Start reporting the given posture value to the Device Posture API. This override can also be set in setDeviceMetricsOverride().
SetDisabledImageTypesParams
Experimental: may change without notice.
SetDisplayFeaturesOverrideParams
Start using the given display features to pupulate the Viewport Segments API. This override can also be set in setDeviceMetricsOverride().
SetDocumentCookieDisabledParams
Experimental: may change without notice.
SetEmitTouchEventsForMouseParams
Experimental: may change without notice.
SetEmulatedMediaParams
Emulates the given media type or media feature for CSS media queries.
SetEmulatedOsTextScaleParams
Emulates the given OS text scale.
SetEmulatedVisionDeficiencyParams
Emulates the given vision deficiency.
SetFocusEmulationEnabledParams
Enables or disables simulating a focused and active page.
SetGeolocationOverrideParams
Overrides the Geolocation Position or Error. Omitting latitude, longitude or accuracy emulates position unavailable.
SetHardwareConcurrencyOverrideParams
Experimental: may change without notice.
SetIdleOverrideParams
Overrides the Idle state.
SetLocaleOverrideParams
Overrides default host system locale with the specified one.
SetNavigatorOverridesParams
Overrides value returned by the javascript navigator object.
SetPageScaleFactorParams
Sets a specified page scale factor.
SetPressureSourceOverrideEnabledParams
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.
SetPressureStateOverrideParams
Provides a given pressure state that will be processed and eventually be delivered to PressureObserver users. |source| must have been previously overridden by setPressureSourceOverrideEnabled.
SetPrimaryScreenParams
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.
SetSafeAreaInsetsOverrideParams
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.
SetScriptExecutionDisabledParams
Switches script execution in the page.
SetScrollbarsHiddenParams
Experimental: may change without notice.
SetSensorOverrideEnabledParams
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.
SetSensorOverrideReadingsParams
Updates the sensor readings reported by a sensor type previously overridden by setSensorOverrideEnabled.
SetSmallViewportHeightDifferenceOverrideParams
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.
SetTimezoneOverrideParams
Overrides default host system timezone with the specified one.
SetTouchEmulationEnabledParams
Enables touch on platforms which do not support them.
SetUserAgentOverrideParams
Allows overriding user agent with the given string. userAgentMetadata must be set for Client Hint headers to be sent.
SetVirtualKeyboardGeometryOverrideParams
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.
SetVirtualTimePolicyParams
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.
SetVirtualTimePolicyReturns
What Emulation.setVirtualTimePolicy answers with.
SetVisibleSizeParams
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.
UpdateScreenParams
Updates specified screen parameters. Only supported in headless mode.
UpdateScreenReturns
What Emulation.updateScreen answers with.
UserAgentBrandVersion
Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
UserAgentMetadata
Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints Missing optional values will be filled in by the target with what it would normally use.
VirtualTimeBudgetExpiredEvent
Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
WorkAreaInsets
Experimental: may change without notice.

Enums§

DevicePostureType
The values type accepts on DevicePosture.
DisabledImageType
Enum of image types that can be disabled.
DisplayFeatureOrientation
The values orientation accepts on DisplayFeature.
PressureSource
Experimental: may change without notice.
PressureState
Experimental: may change without notice.
ScreenOrientationType
The values type accepts on ScreenOrientation.
SensorType
Used to specify sensor types to emulate. See https://w3c.github.io/sensors/#automation for more information.
SetCpuPerformanceOverridePerformanceTier
The values performanceTier accepts on setCPUPerformanceOverride.
SetDeviceMetricsOverrideScrollbarType
The values scrollbarType accepts on setDeviceMetricsOverride.
SetDeviceMetricsOverrideTextLayoutMode
The values textLayoutMode accepts on setDeviceMetricsOverride.
SetDeviceMetricsOverrideViewportMeta
The values viewportMeta accepts on setDeviceMetricsOverride.
SetEmitTouchEventsForMouseConfiguration
The values configuration accepts on setEmitTouchEventsForMouse.
SetEmulatedVisionDeficiencyType
The values type accepts on setEmulatedVisionDeficiency.
VirtualTimePolicy
advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to allow the next delayed task (if any) to run; pause: The virtual time base may not advance; pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending resource fetches.

Type Aliases§

ScreenId
Experimental: may change without notice.