Chrome DevTools Protocol (original) (raw)
Emulation.clearDeviceMetricsOverride#
Clears the overridden device metrics.
Emulation.clearGeolocationOverride#
Clears the overridden Geolocation Position and Error.
Emulation.clearIdleOverride#
Clears Idle state overrides.
Emulation.setCPUThrottlingRate#
Enables CPU throttling to emulate slow CPUs.
parameters
rate
number
Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
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.
parameters
color
RGBA of the default background color. If not specified, any existing override will be cleared.
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.
Experimental
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
Screen orientation override.
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
displayFeature
If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off.
Experimental
devicePosture
If set, the posture of a foldable device. If not set the posture is set to continuous. Deprecated, use Emulation.setDevicePostureOverride.
ExperimentalDeprecated
Emulation.setEmulatedMedia#
Emulates the given media type or media feature for CSS media queries.
parameters
media
string
Media type to emulate. Empty string disables the override.
features
array[ MediaFeature ]
Media features to emulate.
Emulation.setEmulatedVisionDeficiency#
Emulates the given vision deficiency.
parameters
type
string
Vision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
Allowed Values: none
, blurredVision
, reducedContrast
, achromatopsia
, deuteranopia
, protanopia
, tritanopia
Emulation.setGeolocationOverride#
Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
parameters
latitude
number
Mock latitude
longitude
number
Mock longitude
accuracy
number
Mock accuracy
Emulation.setIdleOverride#
Overrides the Idle state.
parameters
isUserActive
boolean
Mock isUserActive
isScreenUnlocked
boolean
Mock isScreenUnlocked
Emulation.setScriptExecutionDisabled#
Switches script execution in the page.
parameters
value
boolean
Whether script execution should be disabled in the page.
Emulation.setTimezoneOverride#
Overrides default host system timezone with the specified one.
parameters
timezoneId
string
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.setUserAgentOverride#
Allows overriding user agent with the given string.userAgentMetadata
must be set for Client Hint headers to be sent.
parameters
userAgent
string
User agent to use.
acceptLanguage
string
Browser language to emulate.
platform
string
The platform navigator.platform should return.
userAgentMetadata
To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
Experimental
Emulation.canEmulateDeprecated #
Tells whether emulation is supported.
Return Object
result
boolean
True if emulation is supported.
Emulation.clearDevicePostureOverrideExperimental #
Clears a device posture override set with either setDeviceMetricsOverride() or setDevicePostureOverride() and starts using posture information from the platform again. Does nothing if no override is set.
Emulation.getOverriddenSensorInformationExperimental #
parameters
type
Return Object
requestedSamplingFrequency
number
Emulation.resetPageScaleFactorExperimental #
Requests that page scale factor is reset to initial values.
Emulation.setAutoDarkModeOverrideExperimental #
Automatically render all web contents using a dark theme.
parameters
enabled
boolean
Whether to enable or disable automatic dark mode. If not specified, any existing override will be cleared.
Emulation.setAutomationOverrideExperimental #
Allows overriding the automation flag.
parameters
enabled
boolean
Whether the override should be enabled.
Emulation.setDevicePostureOverrideExperimental #
Start reporting the given posture value to the Device Posture API. This override can also be set in setDeviceMetricsOverride().
parameters
posture
Emulation.setDisabledImageTypesExperimental #
parameters
imageTypes
array[ DisabledImageType ]
Image types to disable.
Emulation.setDocumentCookieDisabledExperimental #
parameters
disabled
boolean
Whether document.coookie API should be disabled.
Emulation.setEmitTouchEventsForMouseExperimental #
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.setFocusEmulationEnabledExperimental #
Enables or disables simulating a focused and active page.
parameters
enabled
boolean
Whether to enable to disable focus emulation.
Emulation.setHardwareConcurrencyOverrideExperimental #
parameters
hardwareConcurrency
integer
Hardware concurrency to report
Emulation.setLocaleOverrideExperimental #
Overrides default host system locale with the specified one.
parameters
locale
string
ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
Emulation.setPageScaleFactorExperimental #
Sets a specified page scale factor.
parameters
pageScaleFactor
number
Page scale factor.
Emulation.setPressureSourceOverrideEnabledExperimental #
Overrides a pressure source of a given type, as used by the Compute Pressure API, so that updates to PressureObserver.observe() are provided via setPressureStateOverride instead of being retrieved from platform-provided telemetry data.
parameters
enabled
boolean
source
metadata
Emulation.setPressureStateOverrideExperimental #
Provides a given pressure state that will be processed and eventually be delivered to PressureObserver users. |source| must have been previously overridden by setPressureSourceOverrideEnabled.
parameters
source
state
Emulation.setScrollbarsHiddenExperimental #
parameters
hidden
boolean
Whether scrollbars should be always hidden.
Emulation.setSensorOverrideEnabledExperimental #
Overrides a platform sensor of a given type. If |enabled| is true, calls to Sensor.start() will use a virtual sensor as backend rather than fetching data from a real hardware sensor. Otherwise, existing virtual sensor-backend Sensor objects will fire an error event and new calls to Sensor.start() will attempt to use a real sensor instead.
parameters
enabled
boolean
type
metadata
Emulation.setSensorOverrideReadingsExperimental #
Updates the sensor readings reported by a sensor type previously overridden by setSensorOverrideEnabled.
parameters
type
reading
Emulation.setVirtualTimePolicyExperimental #
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
number
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.
initialVirtualTime
If set, base::Time::Now will be overridden to initially return this value.
Return Object
virtualTimeTicksBase
number
Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
Emulation.setNavigatorOverridesExperimentalDeprecated #
Overrides value returned by the javascript navigator object.
parameters
platform
string
The platform navigator.platform should return.
Emulation.setVisibleSizeExperimentalDeprecated #
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
integer
Frame width (DIP).
height
integer
Frame height (DIP).
Emulation.DevicePosture#
Type: object
properties
type
string
Current posture of the device
Allowed Values: continuous
, folded
Emulation.DisplayFeature#
Type: object
properties
orientation
string
Orientation of a display feature in relation to screen
Allowed Values: vertical
, horizontal
offset
integer
The offset from the screen origin in either the x (for vertical orientation) or y (for horizontal orientation) direction.
maskLength
integer
A display feature may mask content such that it is not physically displayed - this length along with the offset describes this area. A display feature that only splits content will have a 0 mask_length.
Emulation.MediaFeature#
Type: object
properties
name
string
value
string
Emulation.ScreenOrientation#
Screen orientation.
Type: object
properties
type
string
Orientation type.
Allowed Values: portraitPrimary
, portraitSecondary
, landscapePrimary
, landscapeSecondary
angle
integer
Orientation angle.
Emulation.DisabledImageTypeExperimental #
Enum of image types that can be disabled.
Allowed Values: avif
, webp
Type: string
Emulation.PressureMetadataExperimental #
Type: object
properties
available
boolean
Emulation.PressureSourceExperimental #
Type: string
Emulation.PressureStateExperimental #
Allowed Values: nominal
, fair
, serious
, critical
Type: string
Emulation.SensorMetadataExperimental #
Type: object
properties
available
boolean
minimumFrequency
number
maximumFrequency
number
Emulation.SensorReadingQuaternionExperimental #
Type: object
properties
x
number
y
number
z
number
w
number
Emulation.SensorReadingSingleExperimental #
Type: object
properties
value
number
Emulation.SensorReadingXYZExperimental #
Type: object
properties
x
number
y
number
z
number
Emulation.SensorTypeExperimental #
Used to specify sensor types to emulate. See https://w3c.github.io/sensors/#automation for more information.
Allowed Values: absolute-orientation
, accelerometer
, ambient-light
, gravity
, gyroscope
, linear-acceleration
, magnetometer
, relative-orientation
Type: string
Emulation.UserAgentBrandVersionExperimental #
Type: object
properties
brand
string
version
string
Emulation.UserAgentMetadataExperimental #
Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hintsMissing optional values will be filled in by the target with what it would normally use.
Type: object
properties
brands
array[ UserAgentBrandVersion ]
Brands appearing in Sec-CH-UA.
fullVersionList
array[ UserAgentBrandVersion ]
Brands appearing in Sec-CH-UA-Full-Version-List.
fullVersion
string Deprecated
platform
string
platformVersion
string
architecture
string
model
string
mobile
boolean
bitness
string
wow64
boolean
Emulation.VirtualTimePolicyExperimental #
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.
Allowed Values: advance
, pause
, pauseIfNetworkFetchesPending
Type: string