java.lang.Object
org.openqa.selenium.devtools.v126.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, Optional<Boolean> includeCommandLineAPI, Optional<Boolean> runImmediately)
      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, Optional<Boolean> captureBeyondViewport, Optional<Boolean> optimizeForSpeed)
      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(Optional<String> manifestId)
      Gets the processed manifest for this current document. This API always waits for the manifest to be loaded. If manifestId is provided, and it does not match the manifest of the current document, this API errors out. If there is not a loaded page, this API errors out immediately.
    • getInstallabilityErrors

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

      @Beta @Deprecated public static org.openqa.selenium.devtools.Command<String> getManifestIcons()
      Deprecated.
      Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation.
    • getAppId

      @Beta public static org.openqa.selenium.devtools.Command<Page.GetAppIdResponse> getAppId()
      Returns the unique (PWA) app id. Only returns values if the feature flag 'WebAppEnableManifestId' is enabled
    • getAdScriptId

      @Beta public static org.openqa.selenium.devtools.Command<AdScriptId> getAdScriptId(FrameId frameId)
    • 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<String> headerTemplate, Optional<String> footerTemplate, Optional<Boolean> preferCSSPageSize, Optional<Page.PrintToPDFTransferMode> transferMode, Optional<Boolean> generateTaggedPDF, Optional<Boolean> generateDocumentOutline)
      Print page as PDF.
    • reload

      public static org.openqa.selenium.devtools.Command<Void> reload(Optional<Boolean> ignoreCache, Optional<String> scriptToEvaluateOnLoad, Optional<LoaderId> loaderId)
      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

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

      @Beta public static org.openqa.selenium.devtools.Command<List<PermissionsPolicyFeatureState>> getPermissionsPolicyState(FrameId frameId)
      Get Permissions Policy state on given frame.
    • getOriginTrials

      @Beta public static org.openqa.selenium.devtools.Command<List<OriginTrial>> getOriginTrials(FrameId frameId)
      Get Origin Trials on given frame.
    • 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, Optional<List<ScriptFontFamilies>> forScripts)
      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

      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

      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`.
    • produceCompilationCache

      @Beta public static org.openqa.selenium.devtools.Command<Void> produceCompilationCache(List<CompilationCacheParams> scripts)
      Requests backend to produce compilation cache for the specified scripts. `scripts` are appended to the list of scripts for which the cache would be produced. The list may be reset during page navigation. When script with a matching URL is encountered, the cache is optionally produced upon backend discretion, based on internal heuristics. See also: `Page.compilationCacheProduced`.
    • 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.
    • setSPCTransactionMode

      @Beta public static org.openqa.selenium.devtools.Command<Void> setSPCTransactionMode(AutoResponseMode mode)
      Sets the Secure Payment Confirmation transaction mode. https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode
    • setRPHRegistrationMode

      @Beta public static org.openqa.selenium.devtools.Command<Void> setRPHRegistrationMode(AutoResponseMode mode)
      Extensions for Custom Handlers API: https://html.spec.whatwg.org/multipage/system-state.html#rph-automation
    • 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

      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.
    • setPrerenderingAllowed

      @Beta public static org.openqa.selenium.devtools.Command<Void> setPrerenderingAllowed(Boolean isAllowed)
      Enable/disable prerendering manually. This command is a short-term solution for https://crbug.com/1440085. See https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA for more details. TODO(https://crbug.com/1440085): Remove this once Puppeteer supports tab targets.
    • 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<FrameDetached> frameDetached()
    • frameNavigated

      public static org.openqa.selenium.devtools.Event<FrameNavigated> frameNavigated()
    • documentOpened

      public static org.openqa.selenium.devtools.Event<Frame> documentOpened()
    • 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()
    • backForwardCacheNotUsed

      public static org.openqa.selenium.devtools.Event<BackForwardCacheNotUsed> backForwardCacheNotUsed()
    • 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()