java.lang.Object
org.openqa.selenium.devtools.v85.page.Page

public class Page extends Object
Actions and events related to the inspected page belong to the page domain.
  • Constructor Details

    • Page

      public Page()
  • Method Details

    • addScriptToEvaluateOnLoad

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<ScriptIdentifier> addScriptToEvaluateOnLoad(String scriptSource)
      Deprecated.
      Deprecated, please use addScriptToEvaluateOnNewDocument instead.
    • addScriptToEvaluateOnNewDocument

      public static org.openqa.selenium.devtools.Command<ScriptIdentifier> addScriptToEvaluateOnNewDocument(String source, Optional<String> worldName)
      Evaluates given script in every frame upon creation (before loading frame's scripts).
    • bringToFront

      public static org.openqa.selenium.devtools.Command<Void> bringToFront()
      Brings page to front (activates tab).
    • captureScreenshot

      public static org.openqa.selenium.devtools.Command<String> captureScreenshot(Optional<Page.CaptureScreenshotFormat> format, Optional<Integer> quality, Optional<Viewport> clip, Optional<Boolean> fromSurface)
      Capture page screenshot.
    • captureSnapshot

      @Beta public static org.openqa.selenium.devtools.Command<String> captureSnapshot(Optional<Page.CaptureSnapshotFormat> format)
      Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.
    • clearDeviceMetricsOverride

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

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> clearDeviceOrientationOverride()
      Deprecated.
      Clears the overridden Device Orientation.
    • clearGeolocationOverride

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

      public static org.openqa.selenium.devtools.Command<ExecutionContextId> createIsolatedWorld(FrameId frameId, Optional<String> worldName, Optional<Boolean> grantUniveralAccess)
      Creates an isolated world for the given frame.
    • deleteCookie

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> deleteCookie(String cookieName, String url)
      Deprecated.
      Deletes browser cookie with given name, domain and path.
    • disable

      public static org.openqa.selenium.devtools.Command<Void> disable()
      Disables page domain notifications.
    • enable

      public static org.openqa.selenium.devtools.Command<Void> enable()
      Enables page domain notifications.
    • getAppManifest

      public static org.openqa.selenium.devtools.Command<Page.GetAppManifestResponse> getAppManifest()
    • getInstallabilityErrors

      @Beta public static org.openqa.selenium.devtools.Command<List<InstallabilityError>> getInstallabilityErrors()
    • getManifestIcons

      @Beta public static org.openqa.selenium.devtools.Command<String> getManifestIcons()
    • getCookies

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<List<Cookie>> getCookies()
      Deprecated.
      Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the `cookies` field.
    • getFrameTree

      public static org.openqa.selenium.devtools.Command<FrameTree> getFrameTree()
      Returns present frame tree structure.
    • getLayoutMetrics

      public static org.openqa.selenium.devtools.Command<Page.GetLayoutMetricsResponse> getLayoutMetrics()
      Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
    • getNavigationHistory

      public static org.openqa.selenium.devtools.Command<Page.GetNavigationHistoryResponse> getNavigationHistory()
      Returns navigation history for the current page.
    • resetNavigationHistory

      public static org.openqa.selenium.devtools.Command<Void> resetNavigationHistory()
      Resets navigation history for the current page.
    • getResourceContent

      @Beta public static org.openqa.selenium.devtools.Command<Page.GetResourceContentResponse> getResourceContent(FrameId frameId, String url)
      Returns content of the given resource.
    • getResourceTree

      @Beta public static org.openqa.selenium.devtools.Command<FrameResourceTree> getResourceTree()
      Returns present frame / resource tree structure.
    • handleJavaScriptDialog

      public static org.openqa.selenium.devtools.Command<Void> handleJavaScriptDialog(Boolean accept, Optional<String> promptText)
      Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
    • printToPDF

      public static org.openqa.selenium.devtools.Command<Page.PrintToPDFResponse> printToPDF(Optional<Boolean> landscape, Optional<Boolean> displayHeaderFooter, Optional<Boolean> printBackground, Optional<Number> scale, Optional<Number> paperWidth, Optional<Number> paperHeight, Optional<Number> marginTop, Optional<Number> marginBottom, Optional<Number> marginLeft, Optional<Number> marginRight, Optional<String> pageRanges, Optional<Boolean> ignoreInvalidPageRanges, Optional<String> headerTemplate, Optional<String> footerTemplate, Optional<Boolean> preferCSSPageSize, Optional<Page.PrintToPDFTransferMode> transferMode)
      Print page as PDF.
    • reload

      public static org.openqa.selenium.devtools.Command<Void> reload(Optional<Boolean> ignoreCache, Optional<String> scriptToEvaluateOnLoad)
      Reloads given page optionally ignoring the cache.
    • removeScriptToEvaluateOnLoad

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> removeScriptToEvaluateOnLoad(ScriptIdentifier identifier)
      Deprecated.
      Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
    • removeScriptToEvaluateOnNewDocument

      public static org.openqa.selenium.devtools.Command<Void> removeScriptToEvaluateOnNewDocument(ScriptIdentifier identifier)
      Removes given script from the list.
    • screencastFrameAck

      @Beta public static org.openqa.selenium.devtools.Command<Void> screencastFrameAck(Integer sessionId)
      Acknowledges that a screencast frame has been received by the frontend.
    • searchInResource

      @Beta public static org.openqa.selenium.devtools.Command<List<SearchMatch>> searchInResource(FrameId frameId, String url, String query, Optional<Boolean> caseSensitive, Optional<Boolean> isRegex)
      Searches for given string in resource content.
    • setAdBlockingEnabled

      @Beta public static org.openqa.selenium.devtools.Command<Void> setAdBlockingEnabled(Boolean enabled)
      Enable Chrome's experimental ad filter on all sites.
    • setBypassCSP

      @Beta public static org.openqa.selenium.devtools.Command<Void> setBypassCSP(Boolean enabled)
      Enable page Content Security Policy by-passing.
    • setDeviceMetricsOverride

      @Beta @Deprecated 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)
      Deprecated.
      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).
    • setDeviceOrientationOverride

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> setDeviceOrientationOverride(Number alpha, Number beta, Number gamma)
      Deprecated.
      Overrides the Device Orientation.
    • setFontFamilies

      @Beta public static org.openqa.selenium.devtools.Command<Void> setFontFamilies(FontFamilies fontFamilies)
      Set generic font families.
    • setFontSizes

      @Beta public static org.openqa.selenium.devtools.Command<Void> setFontSizes(FontSizes fontSizes)
      Set default font sizes.
    • setDocumentContent

      public static org.openqa.selenium.devtools.Command<Void> setDocumentContent(FrameId frameId, String html)
      Sets given markup as the document's HTML.
    • setDownloadBehavior

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> setDownloadBehavior(Page.SetDownloadBehaviorBehavior behavior, Optional<String> downloadPath)
      Deprecated.
      Set the behavior when downloading a file.
    • setGeolocationOverride

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

      @Beta public static org.openqa.selenium.devtools.Command<Void> setLifecycleEventsEnabled(Boolean enabled)
      Controls whether page will emit lifecycle events.
    • setTouchEmulationEnabled

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> setTouchEmulationEnabled(Boolean enabled, Optional<Page.SetTouchEmulationEnabledConfiguration> configuration)
      Deprecated.
      Toggles mouse event-based touch event emulation.
    • startScreencast

      @Beta public static org.openqa.selenium.devtools.Command<Void> startScreencast(Optional<Page.StartScreencastFormat> format, Optional<Integer> quality, Optional<Integer> maxWidth, Optional<Integer> maxHeight, Optional<Integer> everyNthFrame)
      Starts sending each frame using the `screencastFrame` event.
    • stopLoading

      public static org.openqa.selenium.devtools.Command<Void> stopLoading()
      Force the page stop all navigations and pending resource fetches.
    • crash

      @Beta public static org.openqa.selenium.devtools.Command<Void> crash()
      Crashes renderer on the IO thread, generates minidumps.
    • close

      @Beta public static org.openqa.selenium.devtools.Command<Void> close()
      Tries to close page, running its beforeunload hooks, if any.
    • setWebLifecycleState

      @Beta public static org.openqa.selenium.devtools.Command<Void> setWebLifecycleState(Page.SetWebLifecycleStateState state)
      Tries to update the web lifecycle state of the page. It will transition the page to the given state according to: https://github.com/WICG/web-lifecycle/
    • stopScreencast

      @Beta public static org.openqa.selenium.devtools.Command<Void> stopScreencast()
      Stops sending each frame in the `screencastFrame`.
    • setProduceCompilationCache

      @Beta public static org.openqa.selenium.devtools.Command<Void> setProduceCompilationCache(Boolean enabled)
      Forces compilation cache to be generated for every subresource script.
    • addCompilationCache

      @Beta public static org.openqa.selenium.devtools.Command<Void> addCompilationCache(String url, String data)
      Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.
    • clearCompilationCache

      @Beta public static org.openqa.selenium.devtools.Command<Void> clearCompilationCache()
      Clears seeded compilation cache.
    • generateTestReport

      @Beta public static org.openqa.selenium.devtools.Command<Void> generateTestReport(String message, Optional<String> group)
      Generates a report for testing.
    • waitForDebugger

      @Beta public static org.openqa.selenium.devtools.Command<Void> waitForDebugger()
      Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.
    • setInterceptFileChooserDialog

      @Beta public static org.openqa.selenium.devtools.Command<Void> setInterceptFileChooserDialog(Boolean enabled)
      Intercept file chooser requests and transfer control to protocol clients. When file chooser interception is enabled, native file chooser dialog is not shown. Instead, a protocol event `Page.fileChooserOpened` is emitted.
    • domContentEventFired

      public static org.openqa.selenium.devtools.Event<MonotonicTime> domContentEventFired()
    • fileChooserOpened

      public static org.openqa.selenium.devtools.Event<FileChooserOpened> fileChooserOpened()
    • frameAttached

      public static org.openqa.selenium.devtools.Event<FrameAttached> frameAttached()
    • frameClearedScheduledNavigation

      public static org.openqa.selenium.devtools.Event<FrameId> frameClearedScheduledNavigation()
    • frameDetached

      public static org.openqa.selenium.devtools.Event<FrameId> frameDetached()
    • frameNavigated

      public static org.openqa.selenium.devtools.Event<Frame> frameNavigated()
    • frameResized

      public static org.openqa.selenium.devtools.Event<Void> frameResized()
    • frameRequestedNavigation

      public static org.openqa.selenium.devtools.Event<FrameRequestedNavigation> frameRequestedNavigation()
    • frameScheduledNavigation

      public static org.openqa.selenium.devtools.Event<FrameScheduledNavigation> frameScheduledNavigation()
    • frameStartedLoading

      public static org.openqa.selenium.devtools.Event<FrameId> frameStartedLoading()
    • frameStoppedLoading

      public static org.openqa.selenium.devtools.Event<FrameId> frameStoppedLoading()
    • downloadWillBegin

      public static org.openqa.selenium.devtools.Event<DownloadWillBegin> downloadWillBegin()
    • downloadProgress

      public static org.openqa.selenium.devtools.Event<DownloadProgress> downloadProgress()
    • interstitialHidden

      public static org.openqa.selenium.devtools.Event<Void> interstitialHidden()
    • interstitialShown

      public static org.openqa.selenium.devtools.Event<Void> interstitialShown()
    • javascriptDialogClosed

      public static org.openqa.selenium.devtools.Event<JavascriptDialogClosed> javascriptDialogClosed()
    • javascriptDialogOpening

      public static org.openqa.selenium.devtools.Event<JavascriptDialogOpening> javascriptDialogOpening()
    • lifecycleEvent

      public static org.openqa.selenium.devtools.Event<LifecycleEvent> lifecycleEvent()
    • loadEventFired

      public static org.openqa.selenium.devtools.Event<MonotonicTime> loadEventFired()
    • screencastFrame

      public static org.openqa.selenium.devtools.Event<ScreencastFrame> screencastFrame()
    • screencastVisibilityChanged

      public static org.openqa.selenium.devtools.Event<Boolean> screencastVisibilityChanged()
    • windowOpen

      public static org.openqa.selenium.devtools.Event<WindowOpen> windowOpen()
    • compilationCacheProduced

      public static org.openqa.selenium.devtools.Event<CompilationCacheProduced> compilationCacheProduced()