Chrome DevTools Protocol

Methods

Emulation.canEmulate

Tells whether emulation is supported.

Return Object
result
boolean

True if emulation is supported.

Emulation.clearDeviceMetricsOverride

Clears the overridden device metrics.

Emulation.clearGeolocationOverride

Clears the overridden Geolocation Position and Error.

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
color
DOM.RGBA

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
integer

Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.

height
integer

Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.

deviceScaleFactor
number

Overriding device scale factor value. 0 disables the override.

mobile
boolean

Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.

scale
number

Scale to apply to resulting view image.

Experimental
screenWidth
integer

Overriding screen width value in pixels (minimum 0, maximum 10000000).

Experimental
screenHeight
integer

Overriding screen height value in pixels (minimum 0, maximum 10000000).

Experimental
positionX
integer

Overriding view X position on screen in pixels (minimum 0, maximum 10000000).

Experimental
positionY
integer

Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).

Experimental
dontSetVisibleSize
boolean

Do not set visible view size, rely upon explicit setVisibleSize call.

Experimental
screenOrientation
ScreenOrientation

Screen orientation override.

viewport
Page.Viewport

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.

Experimental
displayFeature
DisplayFeature

If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off.

Experimental

Emulation.setEmulatedMedia

Emulates the given media type or media feature for CSS media queries.

parameters
media
string

Media type to emulate. Empty string disables the override.

features
array[ MediaFeature ]

Media features to emulate.

Emulation.setGeolocationOverride

Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.

parameters
latitude
number

Mock latitude

longitude
number

Mock longitude

accuracy
number

Mock accuracy

Emulation.setScriptExecutionDisabled

Switches script execution in the page.

parameters
value
boolean

Whether script execution should be disabled in the page.

Emulation.setTouchEmulationEnabled

Enables touch on platforms which do not support them.

parameters
enabled
boolean

Whether the touch event emulation should be enabled.

maxTouchPoints
integer

Maximum touch points supported. Defaults to one.

Emulation.setUserAgentOverride

Allows overriding user agent with the given string.

parameters
userAgent
string

User agent to use.

acceptLanguage
string

Browser langugage to emulate.

platform
string

The platform navigator.platform should return.

userAgentMetadata
UserAgentMetadata

To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData

Experimental

Types

Emulation.DisplayFeature

Type: object

properties
orientation
string

Orientation of a display feature in relation to screen

Allowed Values: vertical, horizontal
offset
integer

The offset from the screen origin in either the x (for vertical orientation) or y (for horizontal orientation) direction.

maskLength
integer

A 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.MediaFeature

Type: object

properties
name
string
value
string

Emulation.ScreenOrientation

Screen orientation.

Type: object

properties
type
string

Orientation type.

Allowed Values: portraitPrimary, portraitSecondary, landscapePrimary, landscapeSecondary
angle
integer

Orientation angle.