Methods

Chrome DevTools

Emulation.clearDeviceMetricsOverride #

Clears the overriden device metrics.


Chrome DevTools

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
Optional
number

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

Experimental
offsetX
Optional
number

Not used.

ExperimentalDeprecated
offsetY
Optional
number

Not used.

ExperimentalDeprecated
screenWidth
Optional
integer

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

Experimental
screenHeight
Optional
integer

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

Experimental
positionX
Optional
integer

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

Experimental
positionY
Optional
integer

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

Experimental
screenOrientation
Optional
ScreenOrientation

Screen orientation override.


Chrome DevTools

Emulation.setEmulatedMedia #

Emulates the given media for CSS media queries.

Parameters

media
string

Media type to emulate. Empty string disables the override.


Chrome DevTools

Emulation.setTouchEmulationEnabled #

Toggles mouse event-based touch event emulation.

Parameters

enabled
boolean

Whether the touch event emulation should be enabled.

configuration
Optional
string

Touch/gesture events configuration. Default: current platform.

Allowed values: mobile, desktop

Types

Chrome DevTools

Emulation.ScreenOrientation #

Screen orientation.

Type: object

Properties

type
string

Orientation type.

Allowed values: portraitPrimary, portraitSecondary, landscapePrimary, landscapeSecondary

angle
integer

Orientation angle.