Chrome Remote Interface v0.0.5 ChromeRemoteInterface.RPC.Emulation View Source

This domain emulates different environments for the page.

Link to this section Summary

Functions

Tells whether emulation is supported

Clears the overriden device metrics

Clears the overriden Geolocation Position and Error

Overrides the visible area of the page. The change is hidden from the page, i.e. the observable scroll position and page scale does not change. In effect, the command moves the specified area of the page into the top-left corner of the frame

Requests that page scale factor is reset to initial values

Resets the visible area of the page to the original viewport, undoing any effects of the forceViewport command

Enables CPU throttling to emulate slow CPUs

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

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)

Emulates the given media for CSS media queries

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

Sets a specified page scale factor

Switches script execution in the page

Toggles mouse event-based touch event emulation

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

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 to this section Functions

Tells whether emulation is supported.

Parameters:

Link to this function canEmulate(page_pid, parameters) View Source
Link to this function canEmulate(page_pid, parameters, opts) View Source
Link to this function clearDeviceMetricsOverride(page_pid) View Source

Clears the overriden device metrics.

Parameters:

Link to this function clearDeviceMetricsOverride(page_pid, parameters) View Source
Link to this function clearDeviceMetricsOverride(page_pid, parameters, opts) View Source
Link to this function clearGeolocationOverride(page_pid) View Source

Clears the overriden Geolocation Position and Error.

Parameters:

Link to this function clearGeolocationOverride(page_pid, parameters) View Source
Link to this function clearGeolocationOverride(page_pid, parameters, opts) View Source

Overrides the visible area of the page. The change is hidden from the page, i.e. the observable scroll position and page scale does not change. In effect, the command moves the specified area of the page into the top-left corner of the frame.

Parameters: x - - X coordinate of top-left corner of the area (CSS pixels).y - - Y coordinate of top-left corner of the area (CSS pixels).scale - - Scale to apply to the area (relative to a page scale of 1.0).

Link to this function forceViewport(page_pid, parameters) View Source
Link to this function forceViewport(page_pid, parameters, opts) View Source
Link to this function resetPageScaleFactor(page_pid) View Source

Requests that page scale factor is reset to initial values.

Parameters:

Link to this function resetPageScaleFactor(page_pid, parameters) View Source
Link to this function resetPageScaleFactor(page_pid, parameters, opts) View Source

Resets the visible area of the page to the original viewport, undoing any effects of the forceViewport command.

Parameters:

Link to this function resetViewport(page_pid, parameters) View Source
Link to this function resetViewport(page_pid, parameters, opts) View Source
Link to this function setCPUThrottlingRate(page_pid) View Source

Enables CPU throttling to emulate slow CPUs.

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

Link to this function setCPUThrottlingRate(page_pid, parameters) View Source
Link to this function setCPUThrottlingRate(page_pid, parameters, opts) View Source
Link to this function setDefaultBackgroundColorOverride(page_pid) View Source

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: color - - RGBA of the default background color. If not specified, any existing override will be cleared.

Link to this function setDefaultBackgroundColorOverride(page_pid, parameters) View Source
Link to this function setDefaultBackgroundColorOverride(page_pid, parameters, opts) View Source
Link to this function setDeviceMetricsOverride(page_pid) View Source

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.fitWindow - - Whether a view that exceeds the available browser window area should be scaled down to fit.scale - - Scale to apply to resulting view image. Ignored in |fitWindow| mode.offsetX - - Not used.offsetY - - Not used.screenWidth - - Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.screenHeight - - Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.positionX - - Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.positionY - - Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.screenOrientation - - Screen orientation override.

Link to this function setDeviceMetricsOverride(page_pid, parameters) View Source
Link to this function setDeviceMetricsOverride(page_pid, parameters, opts) View Source
Link to this function setEmulatedMedia(page_pid) View Source

Emulates the given media for CSS media queries.

Parameters: media - - Media type to emulate. Empty string disables the override.

Link to this function setEmulatedMedia(page_pid, parameters) View Source
Link to this function setEmulatedMedia(page_pid, parameters, opts) View Source
Link to this function setGeolocationOverride(page_pid) View Source

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

Parameters: latitude - - Mock latitudelongitude - - Mock longitudeaccuracy - - Mock accuracy

Link to this function setGeolocationOverride(page_pid, parameters) View Source
Link to this function setGeolocationOverride(page_pid, parameters, opts) View Source
Link to this function setPageScaleFactor(page_pid) View Source

Sets a specified page scale factor.

Parameters: pageScaleFactor - - Page scale factor.

Link to this function setPageScaleFactor(page_pid, parameters) View Source
Link to this function setPageScaleFactor(page_pid, parameters, opts) View Source
Link to this function setScriptExecutionDisabled(page_pid) View Source

Switches script execution in the page.

Parameters: value - - Whether script execution should be disabled in the page.

Link to this function setScriptExecutionDisabled(page_pid, parameters) View Source
Link to this function setScriptExecutionDisabled(page_pid, parameters, opts) View Source
Link to this function setTouchEmulationEnabled(page_pid) View Source

Toggles mouse event-based touch event emulation.

Parameters: enabled - - Whether the touch event emulation should be enabled.configuration - - Touch/gesture events configuration. Default: current platform.

Link to this function setTouchEmulationEnabled(page_pid, parameters) View Source
Link to this function setTouchEmulationEnabled(page_pid, parameters, opts) View Source
Link to this function setVirtualTimePolicy(page_pid) View Source

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: policy - - budget - - If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.

Link to this function setVirtualTimePolicy(page_pid, parameters) View Source
Link to this function setVirtualTimePolicy(page_pid, parameters, opts) View Source
Link to this function setVisibleSize(page_pid) View Source

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: width - - Frame width (DIP).height - - Frame height (DIP).

Link to this function setVisibleSize(page_pid, parameters) View Source
Link to this function setVisibleSize(page_pid, parameters, opts) View Source