EmulationApi class
This domain emulates different environments for the page.
Constructors
- EmulationApi(Client _client)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- onVirtualTimeBudgetExpired → Stream
-
Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
canEmulate(
) → Future< bool> - Tells whether emulation is supported. Returns: True if emulation is supported.
-
clearDeviceMetricsOverride(
) → Future< void> - Clears the overridden device metrics.
-
clearGeolocationOverride(
) → Future< void> - Clears the overridden Geolocation Position and Error.
-
clearIdleOverride(
) → Future< void> - Clears Idle state overrides.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetPageScaleFactor(
) → Future< void> - Requests that page scale factor is reset to initial values.
-
setAutoDarkModeOverride(
{bool? enabled}) → Future< void> -
Automatically render all web contents using a dark theme.
enabledWhether to enable or disable automatic dark mode. If not specified, any existing override will be cleared. -
setAutomationOverride(
bool enabled) → Future< void> -
Allows overriding the automation flag.
enabledWhether the override should be enabled. -
setCPUThrottlingRate(
num rate) → Future< void> -
Enables CPU throttling to emulate slow CPUs.
rateThrottling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc). -
setDefaultBackgroundColorOverride(
{RGBA? color}) → Future< void> -
Sets or clears an override of the default background color of the frame. This override is used
if the content does not specify one.
colorRGBA of the default background color. If not specified, any existing override will be cleared. -
setDeviceMetricsOverride(
int width, int height, num deviceScaleFactor, bool mobile, {num? scale, int? screenWidth, int? screenHeight, int? positionX, int? positionY, bool? dontSetVisibleSize, ScreenOrientation? screenOrientation, Viewport? viewport, DisplayFeature? displayFeature}) → Future< void> -
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).
widthOverriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.heightOverriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.deviceScaleFactorOverriding device scale factor value. 0 disables the override.mobileWhether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.scaleScale to apply to resulting view image.screenWidthOverriding screen width value in pixels (minimum 0, maximum 10000000).screenHeightOverriding screen height value in pixels (minimum 0, maximum 10000000).positionXOverriding view X position on screen in pixels (minimum 0, maximum 10000000).positionYOverriding view Y position on screen in pixels (minimum 0, maximum 10000000).dontSetVisibleSizeDo not set visible view size, rely upon explicit setVisibleSize call.screenOrientationScreen orientation override.viewportIf 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.displayFeatureIf set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. -
setDisabledImageTypes(
List< DisabledImageType> imageTypes) → Future<void> -
imageTypesImage types to disable. -
setDocumentCookieDisabled(
bool disabled) → Future< void> -
disabledWhether document.coookie API should be disabled. -
setEmitTouchEventsForMouse(
bool enabled, {String? configuration}) → Future< void> -
enabledWhether touch emulation based on mouse input should be enabled.configurationTouch/gesture events configuration. Default: current platform. -
setEmulatedMedia(
{String? media, List< MediaFeature> ? features}) → Future<void> -
Emulates the given media type or media feature for CSS media queries.
mediaMedia type to emulate. Empty string disables the override.featuresMedia features to emulate. -
setEmulatedVisionDeficiency(
String type) → Future< void> -
Emulates the given vision deficiency.
typeVision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies. -
setFocusEmulationEnabled(
bool enabled) → Future< void> -
Enables or disables simulating a focused and active page.
enabledWhether to enable to disable focus emulation. -
setGeolocationOverride(
{num? latitude, num? longitude, num? accuracy}) → Future< void> -
Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position
unavailable.
latitudeMock latitudelongitudeMock longitudeaccuracyMock accuracy -
setHardwareConcurrencyOverride(
int hardwareConcurrency) → Future< void> -
hardwareConcurrencyHardware concurrency to report -
setIdleOverride(
bool isUserActive, bool isScreenUnlocked) → Future< void> -
Overrides the Idle state.
isUserActiveMock isUserActiveisScreenUnlockedMock isScreenUnlocked -
setLocaleOverride(
{String? locale}) → Future< void> -
Overrides default host system locale with the specified one.
localeICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale. -
Overrides value returned by the javascript navigator object.
platformThe platform navigator.platform should return. -
setPageScaleFactor(
num pageScaleFactor) → Future< void> -
Sets a specified page scale factor.
pageScaleFactorPage scale factor. -
setScriptExecutionDisabled(
bool value) → Future< void> -
Switches script execution in the page.
valueWhether script execution should be disabled in the page. -
setScrollbarsHidden(
) → Future< void> -
hiddenWhether scrollbars should be always hidden. -
setTimezoneOverride(
String timezoneId) → Future< void> -
Overrides default host system timezone with the specified one.
timezoneIdThe timezone identifier. If empty, disables the override and restores default host system timezone. -
setTouchEmulationEnabled(
bool enabled, {int? maxTouchPoints}) → Future< void> -
Enables touch on platforms which do not support them.
enabledWhether the touch event emulation should be enabled.maxTouchPointsMaximum touch points supported. Defaults to one. -
setUserAgentOverride(
String userAgent, {String? acceptLanguage, String? platform, UserAgentMetadata? userAgentMetadata}) → Future< void> -
Allows overriding user agent with the given string.
userAgentUser agent to use.acceptLanguageBrowser langugage to emulate.platformThe platform navigator.platform should return.userAgentMetadataTo be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData -
setVirtualTimePolicy(
VirtualTimePolicy policy, {num? budget, int? maxVirtualTimeTaskStarvationCount, TimeSinceEpoch? initialVirtualTime}) → Future< num> -
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.
budgetIf set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.maxVirtualTimeTaskStarvationCountIf set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.initialVirtualTimeIf set, base::Time::Now will be overridden to initially return this value. Returns: Absolute timestamp at which virtual time was first enabled (up time in milliseconds). -
setVisibleSize(
int width, int height) → Future< void> -
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.
widthFrame width (DIP).heightFrame height (DIP). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited