Emulation Domain
This domain emulates different environments for the page.
Methods
- Emulation.clearDeviceMetricsOverride
- Emulation.clearGeolocationOverride
- Emulation.clearIdleOverride
- Emulation.setCPUThrottlingRate
- Emulation.setDefaultBackgroundColorOverride
- Emulation.setDeviceMetricsOverride
- Emulation.setEmulatedMedia
- Emulation.setEmulatedOSTextScale
- Emulation.setEmulatedVisionDeficiency
- Emulation.setGeolocationOverride
- Emulation.setIdleOverride
- Emulation.setScriptExecutionDisabled
- Emulation.setTimezoneOverride
- Emulation.setTouchEmulationEnabled
- Emulation.setUserAgentOverride
Types
Methods
Emulation.setCPUThrottlingRate #
Enables CPU throttling to emulate slow CPUs.
Parameters
rate numberThrottling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
Emulation.setDefaultBackgroundColorOverride #
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
colorOptional
RGBA of the default background color. If not specified, any existing override will be cleared.
Emulation.setDeviceMetricsOverride #
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 integerOverriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
height integerOverriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
deviceScaleFactor numberOverriding device scale factor value. 0 disables the override.
mobile booleanWhether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
scaleOptional
numberScale to apply to resulting view image.
screenWidthOptional
integerOverriding screen width value in pixels (minimum 0, maximum 10000000).
screenHeightOptional
integerOverriding screen height value in pixels (minimum 0, maximum 10000000).
positionXOptional
integerOverriding view X position on screen in pixels (minimum 0, maximum 10000000).
positionYOptional
integerOverriding view Y position on screen in pixels (minimum 0, maximum 10000000).
dontSetVisibleSizeOptional
booleanDo not set visible view size, rely upon explicit setVisibleSize call.
screenOrientationOptional
Screen orientation override.
viewportOptional
If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
displayFeatureOptional
If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. Deprecated, use Emulation.setDisplayFeaturesOverride.
devicePostureOptional
If set, the posture of a foldable device. If not set the posture is set to continuous. Deprecated, use Emulation.setDevicePostureOverride.
Emulation.setEmulatedMedia #
Emulates the given media type or media feature for CSS media queries.
Parameters
mediaOptional
stringMedia type to emulate. Empty string disables the override.
featuresOptional
array[ MediaFeature ]Media features to emulate.
Emulation.setEmulatedVisionDeficiency #
Emulates the given vision deficiency.
Parameters
type stringVision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
Allowed values: none, blurredVision, reducedContrast, achromatopsia, deuteranopia, protanopia, tritanopia
Emulation.setGeolocationOverride #
Overrides the Geolocation Position or Error. Omitting latitude, longitude or accuracy emulates position unavailable.
Parameters
latitudeOptional
numberMock latitude
longitudeOptional
numberMock longitude
accuracyOptional
numberMock accuracy
altitudeOptional
numberMock altitude
altitudeAccuracyOptional
numberMock altitudeAccuracy
headingOptional
numberMock heading
speedOptional
numberMock speed
Emulation.setIdleOverride #
Overrides the Idle state.
Parameters
isUserActive booleanMock isUserActive
isScreenUnlocked booleanMock isScreenUnlocked
Emulation.setScriptExecutionDisabled #
Switches script execution in the page.
Parameters
value booleanWhether script execution should be disabled in the page.
Emulation.setTimezoneOverride #
Overrides default host system timezone with the specified one.
Parameters
timezoneId stringThe timezone identifier. List of supported timezones: https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt If empty, disables the override and restores default host system timezone.
Emulation.setTouchEmulationEnabled #
Enables touch on platforms which do not support them.
Parameters
enabled booleanWhether the touch event emulation should be enabled.
maxTouchPointsOptional
integerMaximum touch points supported. Defaults to one.
Emulation.setUserAgentOverride #
Allows overriding user agent with the given string.
userAgentMetadata must be set for Client Hint headers to be sent.
Parameters
userAgent stringUser agent to use.
acceptLanguageOptional
stringBrowser language to emulate.
platformOptional
stringThe platform navigator.platform should return.
userAgentMetadataOptional
To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
Types
Emulation.DevicePosture #
Type: object
Properties
type stringCurrent posture of the device
Allowed values: continuous, folded
Emulation.DisplayFeature #
Type: object
Properties
orientation stringOrientation of a display feature in relation to screen
Allowed values: vertical, horizontal
offset integerThe offset from the screen origin in either the x (for vertical orientation) or y (for horizontal orientation) direction.
maskLength integerA display feature may mask content such that it is not physically displayed - this length along with the offset describes this area. A display feature that only splits content will have a 0 mask_length.
Emulation.ScreenOrientation #
Screen orientation.
Type: object
Properties
type stringOrientation type.
Allowed values: portraitPrimary, portraitSecondary, landscapePrimary, landscapeSecondary
angle integerOrientation angle.