Chrome DevTools Protocol

Methods

Emulation.clearDeviceMetricsOverride

Clears the overriden device metrics.

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.

fitWindow
boolean

Whether a view that exceeds the available browser window area should be scaled down to fit.

scale
number

Scale to apply to resulting view image. Ignored in |fitWindow| mode.

Experimental
offsetX
number

Not used.

ExperimentalDeprecated
offsetY
number

Not used.

ExperimentalDeprecated
screenWidth
integer

Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.

Experimental
screenHeight
integer

Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.

Experimental
positionX
integer

Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.

Experimental
positionY
integer

Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.

Experimental
screenOrientation
ScreenOrientation

Screen orientation override.

Emulation.setEmulatedMedia

Emulates the given media for CSS media queries.

parameters
media
string

Media type to emulate. Empty string disables the override.

Emulation.setTouchEmulationEnabled

Toggles mouse event-based touch event emulation.

parameters
enabled
boolean

Whether the touch event emulation should be enabled.

configuration
string

Touch/gesture events configuration. Default: current platform.

Allowed Values: mobile, desktop

Types

Emulation.ScreenOrientation

Screen orientation.

Type: object

properties
type
string

Orientation type.

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

Orientation angle.