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).


suspend fun setDeviceMetricsOverride(width: Int, height: Int, deviceScaleFactor: Double, mobile: Boolean, scale: Double? = null, screenWidth: Int? = null, screenHeight: Int? = null, positionX: Int? = null, positionY: Int? = null, dontSetVisibleSize: Boolean? = null, screenOrientation: Emulation.ScreenOrientation? = null, viewport: Page.Viewport? = null, displayFeature: Emulation.DisplayFeature? = null, devicePosture: Emulation.DevicePosture? = null)

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

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

height

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

deviceScaleFactor

Overriding device scale factor value. 0 disables the override.

mobile

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

scale

Scale to apply to resulting view image.

screenWidth

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

screenHeight

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

positionX

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

positionY

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

dontSetVisibleSize

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

screenOrientation

Screen orientation override.

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.

displayFeature

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

devicePosture

If set, the posture of a foldable device. If not set the posture is set to continuous. Deprecated, use Emulation.setDevicePostureOverride.