stable (1.2) latest (tip-of-tree) v8-inspector (node) Home Domains Accessibility Animation ApplicationCache Browser CSS CacheStorage Console DOM DOMDebugger DOMStorage Database Debugger DeviceOrientation Emulation HeapProfiler IO IndexedDB Input Inspector LayerTree Log Memory Network Overlay Page Profiler Runtime Schema Security ServiceWorker Storage SystemInfo Target Tethering Tracing
Chrome DevTools Protocol Viewer - latest (tip-of-tree)

Emulation Domain

This domain emulates different environments for the page.

Methods

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

Parameters
width
integer Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
height
integer Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
deviceScaleFactor
number Overriding device scale factor value. 0 disables the override.
mobile
boolean Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
fitWindow
boolean Whether a view that exceeds the available browser window area should be scaled down to fit.
scale
number Scale to apply to resulting view image. Ignored in |fitWindow| mode. Experimental
offsetX
number Not used. Experimental Deprecated
offsetY
number Not used. Experimental Deprecated
screenWidth
integer Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. Experimental
screenHeight
integer Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. Experimental
positionX
integer Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. Experimental
positionY
integer Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. Experimental
screenOrientation
ScreenOrientation Screen orientation override.

Emulation.clearDeviceMetricsOverride

Clears the overriden device metrics.

Emulation.forceViewport

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

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

Emulation.resetViewport

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

Emulation.resetPageScaleFactor

Requests that page scale factor is reset to initial values. Experimental

Emulation.setPageScaleFactor

Sets a specified page scale factor. Experimental

Parameters
pageScaleFactor
number Page scale factor.

Emulation.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. Experimental

Parameters
width
integer Frame width (DIP).
height
integer Frame height (DIP).

Emulation.setScriptExecutionDisabled

Switches script execution in the page. Experimental

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

Emulation.setGeolocationOverride

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

Parameters
latitude
number Mock latitude
longitude
number Mock longitude
accuracy
number Mock accuracy

Emulation.clearGeolocationOverride

Clears the overriden Geolocation Position and Error. Experimental

Emulation.setTouchEmulationEnabled

Toggles mouse event-based touch event emulation.

Parameters
enabled
boolean Whether the touch event emulation should be enabled.
configuration
string Touch/gesture events configuration. Default: current platform. Allowed values: mobile, desktop.

Emulation.setEmulatedMedia

Emulates the given media for CSS media queries.

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

Emulation.setCPUThrottlingRate

Enables CPU throttling to emulate slow CPUs. Experimental

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

Emulation.canEmulate

Tells whether emulation is supported. Experimental

Return object
result
boolean True if emulation is supported.

Emulation.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. Experimental

Parameters
budget
integer If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.

Emulation.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. Experimental

Parameters
color
DOM.RGBA RGBA of the default background color. If not specified, any existing override will be cleared.

Events

Emulation. virtualTimeBudgetExpired

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

Types

ScreenOrientation

Screen orientation.

Type: object

Properties
type
string Orientation type. Allowed values: portraitPrimary, portraitSecondary, landscapePrimary, landscapeSecondary.
angle
integer Orientation angle.

VirtualTimePolicy

advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to allow the next delayed task (if any) to run; pause: The virtual time base may not advance; pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending resource fetches. Experimental

Type: string

Allowed values

advance, pause, pauseIfNetworkFetchesPending.