Expand description
This domain emulates different environments for the page.
Types, command parameters and event payloads for the Emulation
domain. The method-name constants for the same domain are in
crate::methods.
Structs§
- AddScreen
Params - Add a new screen to the device. Only supported in headless mode.
- AddScreen
Returns - What
Emulation.addScreenanswers with. - CanEmulate
Params - Tells whether emulation is supported.
- CanEmulate
Returns - What
Emulation.canEmulateanswers with. - Clear
Device Metrics Override Params - Clears the overridden device metrics.
- Clear
Device Posture Override Params - 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.
- Clear
Display Features Override Params - Clears the display features override set with either setDeviceMetricsOverride() or setDisplayFeaturesOverride() and starts using display features from the platform again. Does nothing if no override is set.
- Clear
Geolocation Override Params - Clears the overridden Geolocation Position and Error.
- Clear
Idle Override Params - Clears Idle state overrides.
- Device
Posture - Display
Feature - GetOverridden
Sensor Information Params - Experimental: may change without notice.
- GetOverridden
Sensor Information Returns - What
Emulation.getOverriddenSensorInformationanswers with. - GetScreen
Infos Params - Returns device’s screen configuration. In headful mode, the physical screens configuration is returned, whereas in headless mode, a virtual headless screen configuration is provided instead.
- GetScreen
Infos Returns - What
Emulation.getScreenInfosanswers with. - Media
Feature - Pressure
Metadata - Experimental: may change without notice.
- Remove
Screen Params - Remove screen from the device. Only supported in headless mode.
- Reset
Page Scale Factor Params - Requests that page scale factor is reset to initial values.
- Safe
Area Insets - Experimental: may change without notice.
- Screen
Info - Screen information similar to the one returned by window.getScreenDetails() method, see https://w3c.github.io/window-management/#screendetailed.
- Screen
Orientation - Screen orientation.
- Screen
Orientation Lock Changed Event - Fired when a page calls screen.orientation.lock() or screen.orientation.unlock() while device emulation is enabled. This allows the DevTools frontend to update the emulated device orientation accordingly.
- Sensor
Metadata - Experimental: may change without notice.
- Sensor
Reading - Experimental: may change without notice.
- Sensor
Reading Quaternion - Experimental: may change without notice.
- Sensor
Reading Single - Experimental: may change without notice.
- Sensor
Reading Xyz - Experimental: may change without notice.
- SetAuto
Dark Mode Override Params - Automatically render all web contents using a dark theme.
- SetAutomation
Override Params - Allows overriding the automation flag.
- SetCpu
Performance Override Params - Overrides the value of navigator.cpuPerformance
- SetCpu
Throttling Rate Params - Enables CPU throttling to emulate slow CPUs.
- SetData
Saver Override Params - Override the value of navigator.connection.saveData
- SetDefault
Background Color Override Params - Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.
- SetDevice
Metrics Override Params - 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).
- SetDevice
Posture Override Params - Start reporting the given posture value to the Device Posture API. This override can also be set in setDeviceMetricsOverride().
- SetDisabled
Image Types Params - Experimental: may change without notice.
- SetDisplay
Features Override Params - Start using the given display features to pupulate the Viewport Segments API. This override can also be set in setDeviceMetricsOverride().
- SetDocument
Cookie Disabled Params - Experimental: may change without notice.
- SetEmit
Touch Events ForMouse Params - Experimental: may change without notice.
- SetEmulated
Media Params - Emulates the given media type or media feature for CSS media queries.
- SetEmulated
OsText Scale Params - Emulates the given OS text scale.
- SetEmulated
Vision Deficiency Params - Emulates the given vision deficiency.
- SetFocus
Emulation Enabled Params - Enables or disables simulating a focused and active page.
- SetGeolocation
Override Params - Overrides the Geolocation Position or Error. Omitting latitude, longitude or accuracy emulates position unavailable.
- SetHardware
Concurrency Override Params - Experimental: may change without notice.
- SetIdle
Override Params - Overrides the Idle state.
- SetLocale
Override Params - Overrides default host system locale with the specified one.
- SetNavigator
Overrides Params - Overrides value returned by the javascript navigator object.
- SetPage
Scale Factor Params - Sets a specified page scale factor.
- SetPressure
Source Override Enabled Params - 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.
- SetPressure
State Override Params - Provides a given pressure state that will be processed and eventually be delivered to PressureObserver users. |source| must have been previously overridden by setPressureSourceOverrideEnabled.
- SetPrimary
Screen Params - Set primary screen. Only supported in headless mode. Note that this changes the coordinate system origin to the top-left of the new primary screen, updating the bounds and work areas of all existing screens accordingly.
- SetSafe
Area Insets Override Params - Overrides the values for env(safe-area-inset-) and env(safe-area-max-inset-). Unset values will cause the respective variables to be undefined, even if previously overridden.
- SetScript
Execution Disabled Params - Switches script execution in the page.
- SetScrollbars
Hidden Params - Experimental: may change without notice.
- SetSensor
Override Enabled Params - 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.
- SetSensor
Override Readings Params - Updates the sensor readings reported by a sensor type previously overridden by setSensorOverrideEnabled.
- SetSmall
Viewport Height Difference Override Params - Allows overriding the difference between the small and large viewport
sizes, which determine the value of the
svhandlvhunit, respectively. Only supported for top-level frames. - SetTimezone
Override Params - Overrides default host system timezone with the specified one.
- SetTouch
Emulation Enabled Params - Enables touch on platforms which do not support them.
- SetUser
Agent Override Params - Allows overriding user agent with the given string.
userAgentMetadatamust be set for Client Hint headers to be sent. - SetVirtual
Keyboard Geometry Override Params - Overrides virtual keyboard geometry in CSS pixels, relative to the top-level viewport. The provided rect is used for navigator.virtualKeyboard.boundingRect, geometrychange events, and env(keyboard-inset-*) values on the inspected frame. The override applies independently of navigator.virtualKeyboard.overlaysContent so clients can preview overlay geometry without mutating page state. Values are rounded to the nearest CSS pixel. Omitting the rect clears the override.
- SetVirtual
Time Policy Params - 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.
- SetVirtual
Time Policy Returns - What
Emulation.setVirtualTimePolicyanswers with. - SetVisible
Size Params - 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.
- Update
Screen Params - Updates specified screen parameters. Only supported in headless mode.
- Update
Screen Returns - What
Emulation.updateScreenanswers with. - User
Agent Brand Version - Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
- User
Agent Metadata - Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints Missing optional values will be filled in by the target with what it would normally use.
- Virtual
Time Budget Expired Event - Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
- Work
Area Insets - Experimental: may change without notice.
Enums§
- Device
Posture Type - The values
typeaccepts onDevicePosture. - Disabled
Image Type - Enum of image types that can be disabled.
- Display
Feature Orientation - The values
orientationaccepts onDisplayFeature. - Pressure
Source - Experimental: may change without notice.
- Pressure
State - Experimental: may change without notice.
- Screen
Orientation Type - The values
typeaccepts onScreenOrientation. - Sensor
Type - Used to specify sensor types to emulate. See https://w3c.github.io/sensors/#automation for more information.
- SetCpu
Performance Override Performance Tier - The values
performanceTieraccepts onsetCPUPerformanceOverride. - SetDevice
Metrics Override Scrollbar Type - The values
scrollbarTypeaccepts onsetDeviceMetricsOverride. - SetDevice
Metrics Override Text Layout Mode - The values
textLayoutModeaccepts onsetDeviceMetricsOverride. - SetDevice
Metrics Override Viewport Meta - The values
viewportMetaaccepts onsetDeviceMetricsOverride. - SetEmit
Touch Events ForMouse Configuration - The values
configurationaccepts onsetEmitTouchEventsForMouse. - SetEmulated
Vision Deficiency Type - The values
typeaccepts onsetEmulatedVisionDeficiency. - Virtual
Time Policy - 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.
Type Aliases§
- Screen
Id - Experimental: may change without notice.