Class Emulation
- java.lang.Object
-
- org.openqa.selenium.devtools.v114.emulation.Emulation
-
public class Emulation extends java.lang.ObjectThis domain emulates different environments for the page.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEmulation.SetEmitTouchEventsForMouseConfigurationstatic classEmulation.SetEmulatedVisionDeficiencyType
-
Constructor Summary
Constructors Constructor Description Emulation()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.openqa.selenium.devtools.Command<java.lang.Boolean>canEmulate()Tells whether emulation is supported.static org.openqa.selenium.devtools.Command<java.lang.Void>clearDeviceMetricsOverride()Clears the overridden device metrics.static org.openqa.selenium.devtools.Command<java.lang.Void>clearGeolocationOverride()Clears the overridden Geolocation Position and Error.static org.openqa.selenium.devtools.Command<java.lang.Void>clearIdleOverride()Clears Idle state overrides.static org.openqa.selenium.devtools.Command<java.lang.Void>resetPageScaleFactor()Requests that page scale factor is reset to initial values.static org.openqa.selenium.devtools.Command<java.lang.Void>setAutoDarkModeOverride(java.util.Optional<java.lang.Boolean> enabled)Automatically render all web contents using a dark theme.static org.openqa.selenium.devtools.Command<java.lang.Void>setAutomationOverride(java.lang.Boolean enabled)Allows overriding the automation flag.static org.openqa.selenium.devtools.Command<java.lang.Void>setCPUThrottlingRate(java.lang.Number rate)Enables CPU throttling to emulate slow CPUs.static org.openqa.selenium.devtools.Command<java.lang.Void>setDefaultBackgroundColorOverride(java.util.Optional<RGBA> color)Sets or clears an override of the default background color of the frame.static org.openqa.selenium.devtools.Command<java.lang.Void>setDeviceMetricsOverride(java.lang.Integer width, java.lang.Integer height, java.lang.Number deviceScaleFactor, java.lang.Boolean mobile, java.util.Optional<java.lang.Number> scale, java.util.Optional<java.lang.Integer> screenWidth, java.util.Optional<java.lang.Integer> screenHeight, java.util.Optional<java.lang.Integer> positionX, java.util.Optional<java.lang.Integer> positionY, java.util.Optional<java.lang.Boolean> dontSetVisibleSize, java.util.Optional<ScreenOrientation> screenOrientation, java.util.Optional<Viewport> viewport, java.util.Optional<DisplayFeature> displayFeature)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).static org.openqa.selenium.devtools.Command<java.lang.Void>setDisabledImageTypes(java.util.List<DisabledImageType> imageTypes)static org.openqa.selenium.devtools.Command<java.lang.Void>setDocumentCookieDisabled(java.lang.Boolean disabled)static org.openqa.selenium.devtools.Command<java.lang.Void>setEmitTouchEventsForMouse(java.lang.Boolean enabled, java.util.Optional<Emulation.SetEmitTouchEventsForMouseConfiguration> configuration)static org.openqa.selenium.devtools.Command<java.lang.Void>setEmulatedMedia(java.util.Optional<java.lang.String> media, java.util.Optional<java.util.List<MediaFeature>> features)Emulates the given media type or media feature for CSS media queries.static org.openqa.selenium.devtools.Command<java.lang.Void>setEmulatedVisionDeficiency(Emulation.SetEmulatedVisionDeficiencyType type)Emulates the given vision deficiency.static org.openqa.selenium.devtools.Command<java.lang.Void>setFocusEmulationEnabled(java.lang.Boolean enabled)Enables or disables simulating a focused and active page.static org.openqa.selenium.devtools.Command<java.lang.Void>setGeolocationOverride(java.util.Optional<java.lang.Number> latitude, java.util.Optional<java.lang.Number> longitude, java.util.Optional<java.lang.Number> accuracy)Overrides the Geolocation Position or Error.static org.openqa.selenium.devtools.Command<java.lang.Void>setHardwareConcurrencyOverride(java.lang.Integer hardwareConcurrency)static org.openqa.selenium.devtools.Command<java.lang.Void>setIdleOverride(java.lang.Boolean isUserActive, java.lang.Boolean isScreenUnlocked)Overrides the Idle state.static org.openqa.selenium.devtools.Command<java.lang.Void>setLocaleOverride(java.util.Optional<java.lang.String> locale)Overrides default host system locale with the specified one.static org.openqa.selenium.devtools.Command<java.lang.Void>setNavigatorOverrides(java.lang.String platform)Deprecated.static org.openqa.selenium.devtools.Command<java.lang.Void>setPageScaleFactor(java.lang.Number pageScaleFactor)Sets a specified page scale factor.static org.openqa.selenium.devtools.Command<java.lang.Void>setScriptExecutionDisabled(java.lang.Boolean value)Switches script execution in the page.static org.openqa.selenium.devtools.Command<java.lang.Void>setScrollbarsHidden(java.lang.Boolean hidden)static org.openqa.selenium.devtools.Command<java.lang.Void>setTimezoneOverride(java.lang.String timezoneId)Overrides default host system timezone with the specified one.static org.openqa.selenium.devtools.Command<java.lang.Void>setTouchEmulationEnabled(java.lang.Boolean enabled, java.util.Optional<java.lang.Integer> maxTouchPoints)Enables touch on platforms which do not support them.static org.openqa.selenium.devtools.Command<java.lang.Void>setUserAgentOverride(java.lang.String userAgent, java.util.Optional<java.lang.String> acceptLanguage, java.util.Optional<java.lang.String> platform, java.util.Optional<UserAgentMetadata> userAgentMetadata)Allows overriding user agent with the given string.static org.openqa.selenium.devtools.Command<java.lang.Number>setVirtualTimePolicy(VirtualTimePolicy policy, java.util.Optional<java.lang.Number> budget, java.util.Optional<java.lang.Integer> maxVirtualTimeTaskStarvationCount, java.util.Optional<TimeSinceEpoch> initialVirtualTime)Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy.static org.openqa.selenium.devtools.Command<java.lang.Void>setVisibleSize(java.lang.Integer width, java.lang.Integer height)Deprecated.static org.openqa.selenium.devtools.Event<java.lang.Void>virtualTimeBudgetExpired()
-
-
-
Method Detail
-
canEmulate
public static org.openqa.selenium.devtools.Command<java.lang.Boolean> canEmulate()
Tells whether emulation is supported.
-
clearDeviceMetricsOverride
public static org.openqa.selenium.devtools.Command<java.lang.Void> clearDeviceMetricsOverride()
Clears the overridden device metrics.
-
clearGeolocationOverride
public static org.openqa.selenium.devtools.Command<java.lang.Void> clearGeolocationOverride()
Clears the overridden Geolocation Position and Error.
-
resetPageScaleFactor
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> resetPageScaleFactor()
Requests that page scale factor is reset to initial values.
-
setFocusEmulationEnabled
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setFocusEmulationEnabled(java.lang.Boolean enabled)
Enables or disables simulating a focused and active page.
-
setAutoDarkModeOverride
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setAutoDarkModeOverride(java.util.Optional<java.lang.Boolean> enabled)
Automatically render all web contents using a dark theme.
-
setCPUThrottlingRate
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setCPUThrottlingRate(java.lang.Number rate)
Enables CPU throttling to emulate slow CPUs.
-
setDefaultBackgroundColorOverride
public static org.openqa.selenium.devtools.Command<java.lang.Void> setDefaultBackgroundColorOverride(java.util.Optional<RGBA> color)
Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.
-
setDeviceMetricsOverride
public static org.openqa.selenium.devtools.Command<java.lang.Void> setDeviceMetricsOverride(java.lang.Integer width, java.lang.Integer height, java.lang.Number deviceScaleFactor, java.lang.Boolean mobile, java.util.Optional<java.lang.Number> scale, java.util.Optional<java.lang.Integer> screenWidth, java.util.Optional<java.lang.Integer> screenHeight, java.util.Optional<java.lang.Integer> positionX, java.util.Optional<java.lang.Integer> positionY, java.util.Optional<java.lang.Boolean> dontSetVisibleSize, java.util.Optional<ScreenOrientation> screenOrientation, java.util.Optional<Viewport> viewport, java.util.Optional<DisplayFeature> displayFeature)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).
-
setScrollbarsHidden
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setScrollbarsHidden(java.lang.Boolean hidden)
-
setDocumentCookieDisabled
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setDocumentCookieDisabled(java.lang.Boolean disabled)
-
setEmitTouchEventsForMouse
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setEmitTouchEventsForMouse(java.lang.Boolean enabled, java.util.Optional<Emulation.SetEmitTouchEventsForMouseConfiguration> configuration)
-
setEmulatedMedia
public static org.openqa.selenium.devtools.Command<java.lang.Void> setEmulatedMedia(java.util.Optional<java.lang.String> media, java.util.Optional<java.util.List<MediaFeature>> features)Emulates the given media type or media feature for CSS media queries.
-
setEmulatedVisionDeficiency
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setEmulatedVisionDeficiency(Emulation.SetEmulatedVisionDeficiencyType type)
Emulates the given vision deficiency.
-
setGeolocationOverride
public static org.openqa.selenium.devtools.Command<java.lang.Void> setGeolocationOverride(java.util.Optional<java.lang.Number> latitude, java.util.Optional<java.lang.Number> longitude, java.util.Optional<java.lang.Number> accuracy)Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
-
setIdleOverride
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setIdleOverride(java.lang.Boolean isUserActive, java.lang.Boolean isScreenUnlocked)Overrides the Idle state.
-
clearIdleOverride
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> clearIdleOverride()
Clears Idle state overrides.
-
setNavigatorOverrides
@Beta @Deprecated public static org.openqa.selenium.devtools.Command<java.lang.Void> setNavigatorOverrides(java.lang.String platform)
Deprecated.Overrides value returned by the javascript navigator object.
-
setPageScaleFactor
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setPageScaleFactor(java.lang.Number pageScaleFactor)
Sets a specified page scale factor.
-
setScriptExecutionDisabled
public static org.openqa.selenium.devtools.Command<java.lang.Void> setScriptExecutionDisabled(java.lang.Boolean value)
Switches script execution in the page.
-
setTouchEmulationEnabled
public static org.openqa.selenium.devtools.Command<java.lang.Void> setTouchEmulationEnabled(java.lang.Boolean enabled, java.util.Optional<java.lang.Integer> maxTouchPoints)Enables touch on platforms which do not support them.
-
setVirtualTimePolicy
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Number> setVirtualTimePolicy(VirtualTimePolicy policy, java.util.Optional<java.lang.Number> budget, java.util.Optional<java.lang.Integer> maxVirtualTimeTaskStarvationCount, java.util.Optional<TimeSinceEpoch> initialVirtualTime)
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.
-
setLocaleOverride
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setLocaleOverride(java.util.Optional<java.lang.String> locale)
Overrides default host system locale with the specified one.
-
setTimezoneOverride
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setTimezoneOverride(java.lang.String timezoneId)
Overrides default host system timezone with the specified one.
-
setVisibleSize
@Beta @Deprecated public static org.openqa.selenium.devtools.Command<java.lang.Void> setVisibleSize(java.lang.Integer width, java.lang.Integer height)Deprecated.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.
-
setDisabledImageTypes
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setDisabledImageTypes(java.util.List<DisabledImageType> imageTypes)
-
setHardwareConcurrencyOverride
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setHardwareConcurrencyOverride(java.lang.Integer hardwareConcurrency)
-
setUserAgentOverride
public static org.openqa.selenium.devtools.Command<java.lang.Void> setUserAgentOverride(java.lang.String userAgent, java.util.Optional<java.lang.String> acceptLanguage, java.util.Optional<java.lang.String> platform, java.util.Optional<UserAgentMetadata> userAgentMetadata)Allows overriding user agent with the given string.
-
setAutomationOverride
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setAutomationOverride(java.lang.Boolean enabled)
Allows overriding the automation flag.
-
virtualTimeBudgetExpired
public static org.openqa.selenium.devtools.Event<java.lang.Void> virtualTimeBudgetExpired()
-
-