java.lang.Object
org.openqa.selenium.devtools.v85.emulation.Emulation

public class Emulation extends Object
This domain emulates different environments for the page.
  • Constructor Details

    • Emulation

      public Emulation()
  • Method Details

    • canEmulate

      public static org.openqa.selenium.devtools.Command<Boolean> canEmulate()
      Tells whether emulation is supported.
    • clearDeviceMetricsOverride

      public static org.openqa.selenium.devtools.Command<Void> clearDeviceMetricsOverride()
      Clears the overridden device metrics.
    • clearGeolocationOverride

      public static org.openqa.selenium.devtools.Command<Void> clearGeolocationOverride()
      Clears the overridden Geolocation Position and Error.
    • resetPageScaleFactor

      @Beta public static org.openqa.selenium.devtools.Command<Void> resetPageScaleFactor()
      Requests that page scale factor is reset to initial values.
    • setFocusEmulationEnabled

      @Beta public static org.openqa.selenium.devtools.Command<Void> setFocusEmulationEnabled(Boolean enabled)
      Enables or disables simulating a focused and active page.
    • setCPUThrottlingRate

      @Beta public static org.openqa.selenium.devtools.Command<Void> setCPUThrottlingRate(Number rate)
      Enables CPU throttling to emulate slow CPUs.
    • setDefaultBackgroundColorOverride

      public static org.openqa.selenium.devtools.Command<Void> setDefaultBackgroundColorOverride(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<Void> setDeviceMetricsOverride(Integer width, Integer height, Number deviceScaleFactor, Boolean mobile, Optional<Number> scale, Optional<Integer> screenWidth, Optional<Integer> screenHeight, Optional<Integer> positionX, Optional<Integer> positionY, Optional<Boolean> dontSetVisibleSize, Optional<ScreenOrientation> screenOrientation, Optional<Viewport> viewport)
      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<Void> setScrollbarsHidden(Boolean hidden)
    • setDocumentCookieDisabled

      @Beta public static org.openqa.selenium.devtools.Command<Void> setDocumentCookieDisabled(Boolean disabled)
    • setEmitTouchEventsForMouse

      @Beta public static org.openqa.selenium.devtools.Command<Void> setEmitTouchEventsForMouse(Boolean enabled, Optional<Emulation.SetEmitTouchEventsForMouseConfiguration> configuration)
    • setEmulatedMedia

      public static org.openqa.selenium.devtools.Command<Void> setEmulatedMedia(Optional<String> media, Optional<List<MediaFeature>> features)
      Emulates the given media type or media feature for CSS media queries.
    • setEmulatedVisionDeficiency

      @Beta public static org.openqa.selenium.devtools.Command<Void> setEmulatedVisionDeficiency(Emulation.SetEmulatedVisionDeficiencyType type)
      Emulates the given vision deficiency.
    • setGeolocationOverride

      public static org.openqa.selenium.devtools.Command<Void> setGeolocationOverride(Optional<Number> latitude, Optional<Number> longitude, Optional<Number> accuracy)
      Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
    • setNavigatorOverrides

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> setNavigatorOverrides(String platform)
      Deprecated.
      Overrides value returned by the javascript navigator object.
    • setPageScaleFactor

      @Beta public static org.openqa.selenium.devtools.Command<Void> setPageScaleFactor(Number pageScaleFactor)
      Sets a specified page scale factor.
    • setScriptExecutionDisabled

      public static org.openqa.selenium.devtools.Command<Void> setScriptExecutionDisabled(Boolean value)
      Switches script execution in the page.
    • setTouchEmulationEnabled

      public static org.openqa.selenium.devtools.Command<Void> setTouchEmulationEnabled(Boolean enabled, Optional<Integer> maxTouchPoints)
      Enables touch on platforms which do not support them.
    • setVirtualTimePolicy

      @Beta public static org.openqa.selenium.devtools.Command<Number> setVirtualTimePolicy(VirtualTimePolicy policy, Optional<Number> budget, Optional<Integer> maxVirtualTimeTaskStarvationCount, Optional<Boolean> waitForNavigation, 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<Void> setLocaleOverride(Optional<String> locale)
      Overrides default host system locale with the specified one.
    • setTimezoneOverride

      @Beta public static org.openqa.selenium.devtools.Command<Void> setTimezoneOverride(String timezoneId)
      Overrides default host system timezone with the specified one.
    • setVisibleSize

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> setVisibleSize(Integer width, 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.
    • setUserAgentOverride

      public static org.openqa.selenium.devtools.Command<Void> setUserAgentOverride(String userAgent, Optional<String> acceptLanguage, Optional<String> platform, Optional<UserAgentMetadata> userAgentMetadata)
      Allows overriding user agent with the given string.
    • virtualTimeBudgetExpired

      public static org.openqa.selenium.devtools.Event<Void> virtualTimeBudgetExpired()