EmulationDomain

This domain emulates different environments for the page.

Official doc

Functions

Link copied to clipboard

Tells whether emulation is supported.

Link copied to clipboard

Clears the overridden device metrics.

Link copied to clipboard

Clears the overridden Geolocation Position and Error.

Link copied to clipboard

Clears Idle state overrides.

Link copied to clipboard
fun events(): Flow<EmulationEvent>

Subscribes to all events related to this domain.

Link copied to clipboard

Requests that page scale factor is reset to initial values.

Link copied to clipboard

Automatically render all web contents using a dark theme.

Link copied to clipboard
Link copied to clipboard

Enables CPU throttling to emulate slow CPUs.

Link copied to clipboard

Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.

Link copied to clipboard
inline suspend fun setDeviceMetricsOverride(width: Int, height: Int, deviceScaleFactor: Double, mobile: Boolean, optionalArgs: SetDeviceMetricsOverrideRequest.Builder.() -> Unit = {}): SetDeviceMetricsOverrideResponse

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

Link copied to clipboard

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

Link copied to clipboard

Enables or disables simulating a focused and active page.

Link copied to clipboard

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

Link copied to clipboard
suspend fun setIdleOverride(isUserActive: Boolean, isScreenUnlocked: Boolean): SetIdleOverrideResponse

Overrides the Idle state.

Link copied to clipboard

Overrides default host system locale with the specified one.

Link copied to clipboard

Overrides value returned by the javascript navigator object.

Link copied to clipboard

Sets a specified page scale factor.

Link copied to clipboard

Overrides default host system timezone with the specified one.

Link copied to clipboard

Enables touch on platforms which do not support them.

Link copied to clipboard

Allows overriding user agent with the given string.

Link copied to clipboard

Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy. Note this supersedes any previous time budget.

Link copied to clipboard
suspend fun setVisibleSize(width: Int, height: Int): SetVisibleSizeResponse

Resizes the frame/viewport of the page. Note that this does not affect the frame's container (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported on Android.

Link copied to clipboard

Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.