clj-chrome-devtools.commands.emulation

This domain emulates different environments for the page.

can-emulate

(can-emulate)(can-emulate {:as params, :keys []})(can-emulate connection {:as params, :keys []})

Tells whether emulation is supported.

Return map keys:

Key Description
:result True if emulation is supported.

clear-device-metrics-override

(clear-device-metrics-override)(clear-device-metrics-override {:as params, :keys []})(clear-device-metrics-override connection {:as params, :keys []})

Clears the overridden device metrics.

clear-geolocation-override

(clear-geolocation-override)(clear-geolocation-override {:as params, :keys []})(clear-geolocation-override connection {:as params, :keys []})

Clears the overridden Geolocation Position and Error.

clear-idle-override

(clear-idle-override)(clear-idle-override {:as params, :keys []})(clear-idle-override connection {:as params, :keys []})

Clears Idle state overrides.

reset-page-scale-factor

(reset-page-scale-factor)(reset-page-scale-factor {:as params, :keys []})(reset-page-scale-factor connection {:as params, :keys []})

Requests that page scale factor is reset to initial values.

set-auto-dark-mode-override

(set-auto-dark-mode-override)(set-auto-dark-mode-override {:as params, :keys [enabled]})(set-auto-dark-mode-override connection {:as params, :keys [enabled]})

Automatically render all web contents using a dark theme.

Parameters map keys:

Key Description
:enabled Whether to enable or disable automatic dark mode.

If not specified, any existing override will be cleared. (optional)

set-automation-override

(set-automation-override)(set-automation-override {:as params, :keys [enabled]})(set-automation-override connection {:as params, :keys [enabled]})

Allows overriding the automation flag.

Parameters map keys:

Key Description
:enabled Whether the override should be enabled.

set-cpu-throttling-rate

(set-cpu-throttling-rate)(set-cpu-throttling-rate {:as params, :keys [rate]})(set-cpu-throttling-rate connection {:as params, :keys [rate]})

Enables CPU throttling to emulate slow CPUs.

Parameters map keys:

Key Description
:rate Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).

set-default-background-color-override

(set-default-background-color-override)(set-default-background-color-override {:as params, :keys [color]})(set-default-background-color-override connection {:as params, :keys [color]})

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

Parameters map keys:

Key Description
:color RGBA of the default background color. If not specified, any existing override will be

cleared. (optional)

set-device-metrics-override

(set-device-metrics-override)(set-device-metrics-override {:as params, :keys [width height device-scale-factor mobile scale screen-width screen-height position-x position-y dont-set-visible-size screen-orientation viewport display-feature]})(set-device-metrics-override connection {:as params, :keys [width height device-scale-factor mobile scale screen-width screen-height position-x position-y dont-set-visible-size screen-orientation viewport display-feature]})

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 map keys:

Key Description
: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.
:device-scale-factor 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. (optional) :screen-width | Overriding screen width value in pixels (minimum 0, maximum 10000000). (optional) :screen-height | Overriding screen height value in pixels (minimum 0, maximum 10000000). (optional) :position-x | Overriding view X position on screen in pixels (minimum 0, maximum 10000000). (optional) :position-y | Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). (optional) :dont-set-visible-size | Do not set visible view size, rely upon explicit setVisibleSize call. (optional) :screen-orientation | Screen orientation override. (optional) :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. (optional) :display-feature | If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. (optional)

set-disabled-image-types

(set-disabled-image-types)(set-disabled-image-types {:as params, :keys [image-types]})(set-disabled-image-types connection {:as params, :keys [image-types]})

Parameters map keys:

Key Description
:image-types Image types to disable.

set-emit-touch-events-for-mouse

(set-emit-touch-events-for-mouse)(set-emit-touch-events-for-mouse {:as params, :keys [enabled configuration]})(set-emit-touch-events-for-mouse connection {:as params, :keys [enabled configuration]})

Parameters map keys:

Key Description
:enabled Whether touch emulation based on mouse input should be enabled.
:configuration Touch/gesture events configuration. Default: current platform. (optional)

set-emulated-media

(set-emulated-media)(set-emulated-media {:as params, :keys [media features]})(set-emulated-media connection {:as params, :keys [media features]})

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

Parameters map keys:

Key Description
:media Media type to emulate. Empty string disables the override. (optional)
:features Media features to emulate. (optional)

set-emulated-vision-deficiency

(set-emulated-vision-deficiency)(set-emulated-vision-deficiency {:as params, :keys [type]})(set-emulated-vision-deficiency connection {:as params, :keys [type]})

Emulates the given vision deficiency.

Parameters map keys:

Key Description
:type Vision deficiency to emulate.

set-focus-emulation-enabled

(set-focus-emulation-enabled)(set-focus-emulation-enabled {:as params, :keys [enabled]})(set-focus-emulation-enabled connection {:as params, :keys [enabled]})

Enables or disables simulating a focused and active page.

Parameters map keys:

Key Description
:enabled Whether to enable to disable focus emulation.

set-geolocation-override

(set-geolocation-override)(set-geolocation-override {:as params, :keys [latitude longitude accuracy]})(set-geolocation-override connection {:as params, :keys [latitude longitude accuracy]})

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

Parameters map keys:

Key Description
:latitude Mock latitude (optional)
:longitude Mock longitude (optional)
:accuracy Mock accuracy (optional)

set-idle-override

(set-idle-override)(set-idle-override {:as params, :keys [is-user-active is-screen-unlocked]})(set-idle-override connection {:as params, :keys [is-user-active is-screen-unlocked]})

Overrides the Idle state.

Parameters map keys:

Key Description
:is-user-active Mock isUserActive
:is-screen-unlocked Mock isScreenUnlocked

set-locale-override

(set-locale-override)(set-locale-override {:as params, :keys [locale]})(set-locale-override connection {:as params, :keys [locale]})

Overrides default host system locale with the specified one.

Parameters map keys:

Key Description
:locale ICU style C locale (e.g. “en_US”). If not specified or empty, disables the override and

restores default host system locale. (optional)

set-navigator-overrides

(set-navigator-overrides)(set-navigator-overrides {:as params, :keys [platform]})(set-navigator-overrides connection {:as params, :keys [platform]})

Overrides value returned by the javascript navigator object.

Parameters map keys:

Key Description
:platform The platform navigator.platform should return.

set-page-scale-factor

(set-page-scale-factor)(set-page-scale-factor {:as params, :keys [page-scale-factor]})(set-page-scale-factor connection {:as params, :keys [page-scale-factor]})

Sets a specified page scale factor.

Parameters map keys:

Key Description
:page-scale-factor Page scale factor.

set-script-execution-disabled

(set-script-execution-disabled)(set-script-execution-disabled {:as params, :keys [value]})(set-script-execution-disabled connection {:as params, :keys [value]})

Switches script execution in the page.

Parameters map keys:

Key Description
:value Whether script execution should be disabled in the page.

set-scrollbars-hidden

(set-scrollbars-hidden)(set-scrollbars-hidden {:as params, :keys [hidden]})(set-scrollbars-hidden connection {:as params, :keys [hidden]})

Parameters map keys:

Key Description
:hidden Whether scrollbars should be always hidden.

set-timezone-override

(set-timezone-override)(set-timezone-override {:as params, :keys [timezone-id]})(set-timezone-override connection {:as params, :keys [timezone-id]})

Overrides default host system timezone with the specified one.

Parameters map keys:

Key Description
:timezone-id The timezone identifier. If empty, disables the override and

restores default host system timezone.

set-touch-emulation-enabled

(set-touch-emulation-enabled)(set-touch-emulation-enabled {:as params, :keys [enabled max-touch-points]})(set-touch-emulation-enabled connection {:as params, :keys [enabled max-touch-points]})

Enables touch on platforms which do not support them.

Parameters map keys:

Key Description
:enabled Whether the touch event emulation should be enabled.
:max-touch-points Maximum touch points supported. Defaults to one. (optional)

set-user-agent-override

(set-user-agent-override)(set-user-agent-override {:as params, :keys [user-agent accept-language platform user-agent-metadata]})(set-user-agent-override connection {:as params, :keys [user-agent accept-language platform user-agent-metadata]})

Allows overriding user agent with the given string.

Parameters map keys:

Key Description
:user-agent User agent to use.
:accept-language Browser langugage to emulate. (optional)
:platform The platform navigator.platform should return. (optional)
:user-agent-metadata To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData (optional)

set-virtual-time-policy

(set-virtual-time-policy)(set-virtual-time-policy {:as params, :keys [policy budget max-virtual-time-task-starvation-count initial-virtual-time]})(set-virtual-time-policy connection {:as params, :keys [policy budget max-virtual-time-task-starvation-count initial-virtual-time]})

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.

Parameters map keys:

Key Description
:policy null
:budget If set, after this many virtual milliseconds have elapsed virtual time will be paused and a

virtualTimeBudgetExpired event is sent. (optional) :max-virtual-time-task-starvation-count | If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock. (optional) :initial-virtual-time | If set, base::Time::Now will be overridden to initially return this value. (optional)

Return map keys:

Key Description
:virtual-time-ticks-base Absolute timestamp at which virtual time was first enabled (up time in milliseconds).

set-visible-size

(set-visible-size)(set-visible-size {:as params, :keys [width height]})(set-visible-size connection {:as params, :keys [width height]})

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.

Parameters map keys:

Key Description
:width Frame width (DIP).
:height Frame height (DIP).