Class Page
java.lang.Object
org.openqa.selenium.devtools.v115.page.Page
Actions and events related to the inspected page belong to the page domain.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic enumstatic enumstatic enumstatic enumstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.openqa.selenium.devtools.Command<Void>addCompilationCache(String url, String data) Seeds compilation cache for given url.static org.openqa.selenium.devtools.Command<ScriptIdentifier>addScriptToEvaluateOnLoad(String scriptSource) Deprecated.static org.openqa.selenium.devtools.Command<ScriptIdentifier>addScriptToEvaluateOnNewDocument(String source, Optional<String> worldName, Optional<Boolean> includeCommandLineAPI) Evaluates given script in every frame upon creation (before loading frame's scripts).static org.openqa.selenium.devtools.Event<BackForwardCacheNotUsed>static org.openqa.selenium.devtools.Command<Void>Brings page to front (activates tab).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.static org.openqa.selenium.devtools.Command<String>Returns a snapshot of the page as a string.static org.openqa.selenium.devtools.Command<Void>Clears seeded compilation cache.static org.openqa.selenium.devtools.Command<Void>Deprecated.static org.openqa.selenium.devtools.Command<Void>Deprecated.static org.openqa.selenium.devtools.Command<Void>Deprecated.static org.openqa.selenium.devtools.Command<Void>close()Tries to close page, running its beforeunload hooks, if any.static org.openqa.selenium.devtools.Event<CompilationCacheProduced>static org.openqa.selenium.devtools.Command<Void>crash()Crashes renderer on the IO thread, generates minidumps.static org.openqa.selenium.devtools.Command<ExecutionContextId>createIsolatedWorld(FrameId frameId, Optional<String> worldName, Optional<Boolean> grantUniveralAccess) Creates an isolated world for the given frame.static org.openqa.selenium.devtools.Command<Void>deleteCookie(String cookieName, String url) Deprecated.static org.openqa.selenium.devtools.Command<Void>disable()Disables page domain notifications.static org.openqa.selenium.devtools.Event<Frame>static org.openqa.selenium.devtools.Event<MonotonicTime>static org.openqa.selenium.devtools.Event<DownloadProgress>static org.openqa.selenium.devtools.Event<DownloadWillBegin>static org.openqa.selenium.devtools.Command<Void>enable()Enables page domain notifications.static org.openqa.selenium.devtools.Event<FileChooserOpened>static org.openqa.selenium.devtools.Event<FrameAttached>static org.openqa.selenium.devtools.Event<FrameId>static org.openqa.selenium.devtools.Event<FrameDetached>static org.openqa.selenium.devtools.Event<FrameNavigated>static org.openqa.selenium.devtools.Event<FrameRequestedNavigation>static org.openqa.selenium.devtools.Event<Void>static org.openqa.selenium.devtools.Event<FrameScheduledNavigation>static org.openqa.selenium.devtools.Event<FrameId>static org.openqa.selenium.devtools.Event<FrameId>static org.openqa.selenium.devtools.Command<Void>generateTestReport(String message, Optional<String> group) Generates a report for testing.static org.openqa.selenium.devtools.Command<AdScriptId>getAdScriptId(FrameId frameId) static org.openqa.selenium.devtools.Command<Page.GetAppIdResponse>getAppId()Returns the unique (PWA) app id.static org.openqa.selenium.devtools.Command<Page.GetAppManifestResponse>Deprecated.static org.openqa.selenium.devtools.Command<FrameTree>Returns present frame tree structure.static org.openqa.selenium.devtools.Command<List<InstallabilityError>>static org.openqa.selenium.devtools.Command<Page.GetLayoutMetricsResponse>Returns metrics relating to the layouting of the page, such as viewport bounds/scale.static org.openqa.selenium.devtools.Command<String>Deprecated.static org.openqa.selenium.devtools.Command<Page.GetNavigationHistoryResponse>Returns navigation history for the current page.static org.openqa.selenium.devtools.Command<List<OriginTrial>>getOriginTrials(FrameId frameId) Get Origin Trials on given frame.static org.openqa.selenium.devtools.Command<List<PermissionsPolicyFeatureState>>getPermissionsPolicyState(FrameId frameId) Get Permissions Policy state on given frame.static org.openqa.selenium.devtools.Command<Page.GetResourceContentResponse>getResourceContent(FrameId frameId, String url) Returns content of the given resource.static org.openqa.selenium.devtools.Command<FrameResourceTree>Returns present frame / resource tree structure.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).static org.openqa.selenium.devtools.Event<Void>static org.openqa.selenium.devtools.Event<Void>static org.openqa.selenium.devtools.Event<JavascriptDialogClosed>static org.openqa.selenium.devtools.Event<JavascriptDialogOpening>static org.openqa.selenium.devtools.Event<LifecycleEvent>static org.openqa.selenium.devtools.Event<MonotonicTime>static org.openqa.selenium.devtools.Command<Page.NavigateResponse>navigate(String url, Optional<String> referrer, Optional<TransitionType> transitionType, Optional<FrameId> frameId, Optional<ReferrerPolicy> referrerPolicy) Navigates current page to the given URL.static org.openqa.selenium.devtools.Event<NavigatedWithinDocument>static org.openqa.selenium.devtools.Command<Void>navigateToHistoryEntry(Integer entryId) Navigates current page to the given history entry.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) Print page as PDF.static org.openqa.selenium.devtools.Command<Void>Requests backend to produce compilation cache for the specified scripts.static org.openqa.selenium.devtools.Command<Void>Reloads given page optionally ignoring the cache.static org.openqa.selenium.devtools.Command<Void>removeScriptToEvaluateOnLoad(ScriptIdentifier identifier) Deprecated.static org.openqa.selenium.devtools.Command<Void>removeScriptToEvaluateOnNewDocument(ScriptIdentifier identifier) Removes given script from the list.static org.openqa.selenium.devtools.Command<Void>Resets navigation history for the current page.static org.openqa.selenium.devtools.Event<ScreencastFrame>static org.openqa.selenium.devtools.Command<Void>screencastFrameAck(Integer sessionId) Acknowledges that a screencast frame has been received by the frontend.static org.openqa.selenium.devtools.Event<Boolean>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.static org.openqa.selenium.devtools.Command<Void>setAdBlockingEnabled(Boolean enabled) Enable Chrome's experimental ad filter on all sites.static org.openqa.selenium.devtools.Command<Void>setBypassCSP(Boolean enabled) Enable page Content Security Policy by-passing.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.static org.openqa.selenium.devtools.Command<Void>setDeviceOrientationOverride(Number alpha, Number beta, Number gamma) Deprecated.static org.openqa.selenium.devtools.Command<Void>setDocumentContent(FrameId frameId, String html) Sets given markup as the document's HTML.static org.openqa.selenium.devtools.Command<Void>setDownloadBehavior(Page.SetDownloadBehaviorBehavior behavior, Optional<String> downloadPath) Deprecated.static org.openqa.selenium.devtools.Command<Void>setFontFamilies(FontFamilies fontFamilies, Optional<List<ScriptFontFamilies>> forScripts) Set generic font families.static org.openqa.selenium.devtools.Command<Void>setFontSizes(FontSizes fontSizes) Set default font sizes.static org.openqa.selenium.devtools.Command<Void>setGeolocationOverride(Optional<Number> latitude, Optional<Number> longitude, Optional<Number> accuracy) Deprecated.static org.openqa.selenium.devtools.Command<Void>setInterceptFileChooserDialog(Boolean enabled) Intercept file chooser requests and transfer control to protocol clients.static org.openqa.selenium.devtools.Command<Void>setLifecycleEventsEnabled(Boolean enabled) Controls whether page will emit lifecycle events.static org.openqa.selenium.devtools.Command<Void>Extensions for Custom Handlers API: https://html.spec.whatwg.org/multipage/system-state.html#rph-automationstatic org.openqa.selenium.devtools.Command<Void>Sets the Secure Payment Confirmation transaction mode.static org.openqa.selenium.devtools.Command<Void>setTouchEmulationEnabled(Boolean enabled, Optional<Page.SetTouchEmulationEnabledConfiguration> configuration) Deprecated.static org.openqa.selenium.devtools.Command<Void>Tries to update the web lifecycle state of the page.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.static org.openqa.selenium.devtools.Command<Void>Force the page stop all navigations and pending resource fetches.static org.openqa.selenium.devtools.Command<Void>Stops sending each frame in the `screencastFrame`.static org.openqa.selenium.devtools.Command<Void>Pauses page execution.static org.openqa.selenium.devtools.Event<WindowOpen>
-
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) Evaluates given script in every frame upon creation (before loading frame's scripts). -
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.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
Disables page domain notifications. -
enable
Enables page domain notifications. -
getAppManifest
-
getInstallabilityErrors
@Beta public static org.openqa.selenium.devtools.Command<List<InstallabilityError>> getInstallabilityErrors() -
getManifestIcons
Deprecated.Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation. -
getAppId
Returns the unique (PWA) app id. Only returns values if the feature flag 'WebAppEnableManifestId' is enabled -
getAdScriptId
-
getCookies
Deprecated.Returns all browser cookies for the page and all of its subframes. Depending on the backend support, will return detailed cookie information in the `cookies` field. -
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. -
getResourceContent
@Beta public static org.openqa.selenium.devtools.Command<Page.GetResourceContentResponse> getResourceContent(FrameId frameId, String url) Returns content of the given resource. -
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) 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
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
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
Force the page stop all navigations and pending resource fetches. -
crash
Crashes renderer on the IO thread, generates minidumps. -
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
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 appeneded 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
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
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
-
fileChooserOpened
-
frameAttached
-
frameDetached
-
documentOpened
-
frameResized
-
frameStartedLoading
-
frameStoppedLoading
-
downloadWillBegin
-
downloadProgress
-
interstitialHidden
-
interstitialShown
-
javascriptDialogClosed
-
javascriptDialogOpening
-
lifecycleEvent
-
backForwardCacheNotUsed
-
loadEventFired
-
screencastFrame
-
screencastVisibilityChanged
-
windowOpen
-
compilationCacheProduced
public static org.openqa.selenium.devtools.Event<CompilationCacheProduced> compilationCacheProduced()
-