stable (1.2) latest (tip-of-tree) v8-inspector (node) Home
Domains
Accessibility Animation ApplicationCache Audits Browser CSS CacheStorage Console DOM DOMDebugger DOMSnapshot DOMStorage Database Debugger DeviceOrientation Emulation HeadlessExperimental HeapProfiler IO IndexedDB Input Inspector LayerTree Log Memory Network Overlay Page Performance 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.
scale
number Scale to apply to resulting view image.
screenWidth
integer Overriding screen width value in pixels (minimum 0, maximum 10000000). Experimental
screenHeight
integer Overriding screen height value in pixels (minimum 0, maximum 10000000). Experimental
positionX
integer Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Experimental
positionY
integer Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Experimental
dontSetVisibleSize
boolean Do not set visible view size, rely upon explicit setVisibleSize call. Experimental
screenOrientation
ScreenOrientation Screen orientation override.
viewport
Page.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. Experimental

Emulation.clearDeviceMetricsOverride

Clears the overriden device metrics.

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 Deprecated

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

Enables touch on platforms which do not support them.

Parameters
enabled
boolean Whether the touch event emulation should be enabled.
maxTouchPoints
integer Maximum touch points supported. Defaults to one.

Emulation.setEmitTouchEventsForMouse

Experimental

Parameters
enabled
boolean Whether touch emulation based on mouse input 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.
maxVirtualTimeTaskStarvationCount
integer If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.

Emulation.setNavigatorOverrides

Overrides value returned by the javascript navigator object. Experimental

Parameters
platform
string The platform navigator.platform should return.

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 virtual time budget for the current VirtualTimePolicy has run out. Experimental

Emulation.virtualTimeAdvanced

Notification sent after the virtual time has advanced. Experimental

Parameters
virtualTimeElapsed
integer The amount of virtual time that has elapsed in milliseconds since virtual time was first enabled.

Emulation.virtualTimePaused

Notification sent after the virtual time has paused. Experimental

Parameters
virtualTimeElapsed
integer The amount of virtual time that has elapsed in milliseconds since virtual time was first enabled.

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.