pl.wendigo.chrome.api.page / PageOperations

PageOperations

class PageOperations (source)

Actions and events related to the inspected page belong to the page domain.

Link
Protocol Page domain documentation.

Functions

addCompilationCache

fun addCompilationCache(input: AddCompilationCacheRequest): Single<ResponseFrame>

Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.

addScriptToEvaluateOnLoad

fun addScriptToEvaluateOnLoad(input: AddScriptToEvaluateOnLoadRequest): Single<AddScriptToEvaluateOnLoadResponse>

Deprecated, please use addScriptToEvaluateOnNewDocument instead.

addScriptToEvaluateOnNewDocument

fun addScriptToEvaluateOnNewDocument(input: AddScriptToEvaluateOnNewDocumentRequest): Single<AddScriptToEvaluateOnNewDocumentResponse>

Evaluates given script in every frame upon creation (before loading frame's scripts).

bringToFront

fun bringToFront(): Single<ResponseFrame>

Brings page to front (activates tab).

captureScreenshot

fun captureScreenshot(input: CaptureScreenshotRequest): Single<CaptureScreenshotResponse>

Capture page screenshot.

captureSnapshot

fun captureSnapshot(input: CaptureSnapshotRequest): Single<CaptureSnapshotResponse>

Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.

clearCompilationCache

fun clearCompilationCache(): Single<ResponseFrame>

Clears seeded compilation cache.

clearDeviceMetricsOverride

fun clearDeviceMetricsOverride(): Single<ResponseFrame>

Clears the overriden device metrics.

clearDeviceOrientationOverride

fun clearDeviceOrientationOverride(): Single<ResponseFrame>

Clears the overridden Device Orientation.

clearGeolocationOverride

fun clearGeolocationOverride(): Single<ResponseFrame>

Clears the overriden Geolocation Position and Error.

close

fun close(): Single<ResponseFrame>

Tries to close page, running its beforeunload hooks, if any.

compilationCacheProduced

fun compilationCacheProduced(): Flowable<CompilationCacheProducedEvent>

Issued for every compilation cache generated. Is only available if Page.setGenerateCompilationCache is enabled.

crash

fun crash(): Single<ResponseFrame>

Crashes renderer on the IO thread, generates minidumps.

createIsolatedWorld

fun createIsolatedWorld(input: CreateIsolatedWorldRequest): Single<CreateIsolatedWorldResponse>

Creates an isolated world for the given frame.

deleteCookie

fun deleteCookie(input: DeleteCookieRequest): Single<ResponseFrame>

Deletes browser cookie with given name, domain and path.

disable

fun disable(): Single<ResponseFrame>

Disables page domain notifications.

domContentEventFired

fun domContentEventFired(): Flowable<DomContentEventFiredEvent>

Returns observable capturing all Page.domContentEventFired events.

downloadWillBegin

fun downloadWillBegin(): Flowable<DownloadWillBeginEvent>

Fired when page is about to start a download.

enable

fun enable(): Single<ResponseFrame>

Enables page domain notifications.

events

fun events(): Flowable<Event>

Returns flowable capturing all Page domains events.

fileChooserOpened

fun fileChooserOpened(): Flowable<FileChooserOpenedEvent>

Emitted only when page.interceptFileChooser is enabled.

frameAttached

fun frameAttached(): Flowable<FrameAttachedEvent>

Fired when frame has been attached to its parent.

frameClearedScheduledNavigation

fun frameClearedScheduledNavigation(): Flowable<FrameClearedScheduledNavigationEvent>

Fired when frame no longer has a scheduled navigation.

frameDetached

fun frameDetached(): Flowable<FrameDetachedEvent>

Fired when frame has been detached from its parent.

frameNavigated

fun frameNavigated(): Flowable<FrameNavigatedEvent>

Fired once navigation of the frame has completed. Frame is now associated with the new loader.

frameRequestedNavigation

fun frameRequestedNavigation(): Flowable<FrameRequestedNavigationEvent>

Fired when a renderer-initiated navigation is requested. Navigation may still be cancelled after the event is issued.

frameResized

fun frameResized(): Flowable<Event>

Returns observable capturing all Page.frameResized events.

frameScheduledNavigation

fun frameScheduledNavigation(): Flowable<FrameScheduledNavigationEvent>

Fired when frame schedules a potential navigation.

frameStartedLoading

fun frameStartedLoading(): Flowable<FrameStartedLoadingEvent>

Fired when frame has started loading.

frameStoppedLoading

fun frameStoppedLoading(): Flowable<FrameStoppedLoadingEvent>

Fired when frame has stopped loading.

generateTestReport

fun generateTestReport(input: GenerateTestReportRequest): Single<ResponseFrame>

Generates a report for testing.

getAppManifest

fun getAppManifest(): Single<GetAppManifestResponse>

getCookies

fun getCookies(): Single<GetCookiesResponse>

Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field.

getFrameTree

fun getFrameTree(): Single<GetFrameTreeResponse>

Returns present frame tree structure.

getInstallabilityErrors

fun getInstallabilityErrors(): Single<GetInstallabilityErrorsResponse>

getLayoutMetrics

fun getLayoutMetrics(): Single<GetLayoutMetricsResponse>

Returns metrics relating to the layouting of the page, such as viewport bounds/scale.

getManifestIcons

fun getManifestIcons(): Single<GetManifestIconsResponse>

getNavigationHistory

fun getNavigationHistory(): Single<GetNavigationHistoryResponse>

Returns navigation history for the current page.

getResourceContent

fun getResourceContent(input: GetResourceContentRequest): Single<GetResourceContentResponse>

Returns content of the given resource.

getResourceTree

fun getResourceTree(): Single<GetResourceTreeResponse>

Returns present frame / resource tree structure.

handleJavaScriptDialog

fun handleJavaScriptDialog(input: HandleJavaScriptDialogRequest): Single<ResponseFrame>

Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).

interstitialHidden

fun interstitialHidden(): Flowable<Event>

Fired when interstitial page was hidden

interstitialShown

fun interstitialShown(): Flowable<Event>

Fired when interstitial page was shown

javascriptDialogClosed

fun javascriptDialogClosed(): Flowable<JavascriptDialogClosedEvent>

Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.

javascriptDialogOpening

fun javascriptDialogOpening(): Flowable<JavascriptDialogOpeningEvent>

Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.

lifecycleEvent

fun lifecycleEvent(): Flowable<LifecycleEventEvent>

Fired for top level page lifecycle events such as navigation, load, paint, etc.

loadEventFired

fun loadEventFired(): Flowable<LoadEventFiredEvent>

Returns observable capturing all Page.loadEventFired events.

navigate

fun navigate(input: NavigateRequest): Single<NavigateResponse>

Navigates current page to the given URL.

navigatedWithinDocument

fun navigatedWithinDocument(): Flowable<NavigatedWithinDocumentEvent>

Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation.

navigateToHistoryEntry

fun navigateToHistoryEntry(input: NavigateToHistoryEntryRequest): Single<ResponseFrame>

Navigates current page to the given history entry.

printToPDF

fun printToPDF(input: PrintToPDFRequest): Single<PrintToPDFResponse>

Print page as PDF.

reload

fun reload(input: ReloadRequest): Single<ResponseFrame>

Reloads given page optionally ignoring the cache.

removeScriptToEvaluateOnLoad

fun removeScriptToEvaluateOnLoad(input: RemoveScriptToEvaluateOnLoadRequest): Single<ResponseFrame>

Deprecated, please use removeScriptToEvaluateOnNewDocument instead.

removeScriptToEvaluateOnNewDocument

fun removeScriptToEvaluateOnNewDocument(input: RemoveScriptToEvaluateOnNewDocumentRequest): Single<ResponseFrame>

Removes given script from the list.

resetNavigationHistory

fun resetNavigationHistory(): Single<ResponseFrame>

Resets navigation history for the current page.

screencastFrame

fun screencastFrame(): Flowable<ScreencastFrameEvent>

Compressed image data requested by the startScreencast.

screencastFrameAck

fun screencastFrameAck(input: ScreencastFrameAckRequest): Single<ResponseFrame>

Acknowledges that a screencast frame has been received by the frontend.

screencastVisibilityChanged

fun screencastVisibilityChanged(): Flowable<ScreencastVisibilityChangedEvent>

Fired when the page with currently enabled screencast was shown or hidden `.

searchInResource

fun searchInResource(input: SearchInResourceRequest): Single<SearchInResourceResponse>

Searches for given string in resource content.

setAdBlockingEnabled

fun setAdBlockingEnabled(input: SetAdBlockingEnabledRequest): Single<ResponseFrame>

Enable Chrome's experimental ad filter on all sites.

setBypassCSP

fun setBypassCSP(input: SetBypassCSPRequest): Single<ResponseFrame>

Enable page Content Security Policy by-passing.

setDeviceMetricsOverride

fun setDeviceMetricsOverride(input: SetDeviceMetricsOverrideRequest): Single<ResponseFrame>

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

fun setDeviceOrientationOverride(input: SetDeviceOrientationOverrideRequest): Single<ResponseFrame>

Overrides the Device Orientation.

setDocumentContent

fun setDocumentContent(input: SetDocumentContentRequest): Single<ResponseFrame>

Sets given markup as the document's HTML.

setDownloadBehavior

fun setDownloadBehavior(input: SetDownloadBehaviorRequest): Single<ResponseFrame>

Set the behavior when downloading a file.

setFontFamilies

fun setFontFamilies(input: SetFontFamiliesRequest): Single<ResponseFrame>

Set generic font families.

setFontSizes

fun setFontSizes(input: SetFontSizesRequest): Single<ResponseFrame>

Set default font sizes.

setGeolocationOverride

fun setGeolocationOverride(input: SetGeolocationOverrideRequest): Single<ResponseFrame>

Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.

setInterceptFileChooserDialog

fun setInterceptFileChooserDialog(input: SetInterceptFileChooserDialogRequest): Single<ResponseFrame>

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.

setLifecycleEventsEnabled

fun setLifecycleEventsEnabled(input: SetLifecycleEventsEnabledRequest): Single<ResponseFrame>

Controls whether page will emit lifecycle events.

setProduceCompilationCache

fun setProduceCompilationCache(input: SetProduceCompilationCacheRequest): Single<ResponseFrame>

Forces compilation cache to be generated for every subresource script.

setTouchEmulationEnabled

fun setTouchEmulationEnabled(input: SetTouchEmulationEnabledRequest): Single<ResponseFrame>

Toggles mouse event-based touch event emulation.

setWebLifecycleState

fun setWebLifecycleState(input: SetWebLifecycleStateRequest): Single<ResponseFrame>

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/

startScreencast

fun startScreencast(input: StartScreencastRequest): Single<ResponseFrame>

Starts sending each frame using the screencastFrame event.

stopLoading

fun stopLoading(): Single<ResponseFrame>

Force the page stop all navigations and pending resource fetches.

stopScreencast

fun stopScreencast(): Single<ResponseFrame>

Stops sending each frame in the screencastFrame.

waitForDebugger

fun waitForDebugger(): Single<ResponseFrame>

Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.

windowOpen

fun windowOpen(): Flowable<WindowOpenEvent>

Fired when a new window is going to be opened, via window.open(), link click, form submission, etc.