Class DevToolsWrapper

java.lang.Object
com.vaadin.flow.testutil.DevToolsWrapper

public class DevToolsWrapper extends Object
Controls browser network conditions through the Chrome DevTools Protocol.

The CDP commands are built by hand rather than through the generated org.openqa.selenium.devtools.vNNN classes or the version-independent Domains facade in front of them. Selenium picks a generated implementation by matching the browser major version against the CDP implementations it bundles, and it only ever falls back to an implementation older than the browser. A Selenium release bundles the few newest Chrome versions, so a browser older than all of them matches nothing and resolves to a no-op implementation that throws on every call. The commands used here are part of the stable CDP surface and are sent over the raw connection, which makes them work with any Chrome version.

  • Constructor Details

    • DevToolsWrapper

      public DevToolsWrapper(org.openqa.selenium.WebDriver driver)
  • Method Details

    • setOfflineEnabled

      public void setOfflineEnabled(Boolean isEnabled)
      Controls the throttling `Offline` option in DevTools via the corresponding Selenium API.
      Parameters:
      isEnabled - whether to enable the offline mode.
    • setCacheDisabled

      public void setCacheDisabled(Boolean isDisabled)
      Controls the `Disable cache` option in DevTools via the corresponding Selenium API.
      Parameters:
      isDisabled - whether to disable the browser cache.
    • close

      public void close()