chrome-devtools-kotlin / org.hildan.chrome.devtools.domains.emulation / EmulationDomain

EmulationDomain

class EmulationDomain

This domain emulates different environments for the page.

Official doc

Functions

canEmulate

Tells whether emulation is supported.

suspend fun canEmulate(): CanEmulateResponse

clearDeviceMetricsOverride

Clears the overriden device metrics.

suspend fun clearDeviceMetricsOverride(): Unit

clearGeolocationOverride

Clears the overriden Geolocation Position and Error.

suspend fun clearGeolocationOverride(): Unit

clearIdleOverride

Clears Idle state overrides.

suspend fun clearIdleOverride(): Unit

events

Subscribes to all events related to this domain.

fun events(): Flow<EmulationEvent>

resetPageScaleFactor

Requests that page scale factor is reset to initial values.

suspend fun resetPageScaleFactor(): Unit

setCPUThrottlingRate

Enables CPU throttling to emulate slow CPUs.

suspend fun setCPUThrottlingRate(input: SetCPUThrottlingRateRequest): Unit

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.

suspend fun setDefaultBackgroundColorOverride(input: SetDefaultBackgroundColorOverrideRequest): Unit

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(input: SetDeviceMetricsOverrideRequest): Unit

setDocumentCookieDisabled

Official doc

suspend fun setDocumentCookieDisabled(input: SetDocumentCookieDisabledRequest): Unit

setEmitTouchEventsForMouse

Official doc

suspend fun setEmitTouchEventsForMouse(input: SetEmitTouchEventsForMouseRequest): Unit

setEmulatedMedia

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

suspend fun setEmulatedMedia(input: SetEmulatedMediaRequest): Unit

setEmulatedVisionDeficiency

Emulates the given vision deficiency.

suspend fun setEmulatedVisionDeficiency(input: SetEmulatedVisionDeficiencyRequest): Unit

setFocusEmulationEnabled

Enables or disables simulating a focused and active page.

suspend fun setFocusEmulationEnabled(input: SetFocusEmulationEnabledRequest): Unit

setGeolocationOverride

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

suspend fun setGeolocationOverride(input: SetGeolocationOverrideRequest): Unit

setIdleOverride

Overrides the Idle state.

suspend fun setIdleOverride(input: SetIdleOverrideRequest): Unit

setLocaleOverride

Overrides default host system locale with the specified one.

suspend fun setLocaleOverride(input: SetLocaleOverrideRequest): Unit

setNavigatorOverrides

Overrides value returned by the javascript navigator object.

suspend fun setNavigatorOverrides(input: SetNavigatorOverridesRequest): Unit

setPageScaleFactor

Sets a specified page scale factor.

suspend fun setPageScaleFactor(input: SetPageScaleFactorRequest): Unit

setScriptExecutionDisabled

Switches script execution in the page.

suspend fun setScriptExecutionDisabled(input: SetScriptExecutionDisabledRequest): Unit

setScrollbarsHidden

Official doc

suspend fun setScrollbarsHidden(input: SetScrollbarsHiddenRequest): Unit

setTimezoneOverride

Overrides default host system timezone with the specified one.

suspend fun setTimezoneOverride(input: SetTimezoneOverrideRequest): Unit

setTouchEmulationEnabled

Enables touch on platforms which do not support them.

suspend fun setTouchEmulationEnabled(input: SetTouchEmulationEnabledRequest): Unit

setUserAgentOverride

Allows overriding user agent with the given string.

suspend fun setUserAgentOverride(input: SetUserAgentOverrideRequest): Unit

setVirtualTimePolicy

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.

suspend fun setVirtualTimePolicy(input: SetVirtualTimePolicyRequest): SetVirtualTimePolicyResponse

setVisibleSize

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.

suspend fun setVisibleSize(input: SetVisibleSizeRequest): Unit

virtualTimeBudgetExpired

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

fun virtualTimeBudgetExpired(): Flow<VirtualTimeBudgetExpiredEvent>