This module provides a direct mapping of CDP events and commands for v1.3 (stable) of the Page Domain.
Actions and events related to the inspected page belong to the page domain.
Types
Page {.pure.} = enum domContentEventFired = "Page.domContentEventFired", fileChooserOpened = "Page.fileChooserOpened", frameAttached = "Page.frameAttached", frameDetached = "Page.frameDetached", frameNavigated = "Page.frameNavigated", interstitialHidden = "Page.interstitialHidden", interstitialShown = "Page.interstitialShown", javascriptDialogClosed = "Page.javascriptDialogClosed", javascriptDialogOpening = "Page.javascriptDialogOpening", lifecycleEvent = "Page.lifecycleEvent", loadEventFired = "Page.loadEventFired", windowOpen = "Page.windowOpen"
- Page Domain events
Procs
proc addScriptToEvaluateOnLoad(tab: Tab; source: string): Future[JsonNode] {. ...stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc addScriptToEvaluateOnLoad(tab: Tab; source: string; params: JsonNode): Future[ JsonNode] {....stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Page.addScriptToEvaluateOnLoad
Evaluates given script in every frame upon creation (before loading frame's scripts).
proc bringToFront(tab: Tab): owned(Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Brings page to front (activates tab).
proc captureScreenshot(tab: Tab): Future[JsonNode] {....stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc captureScreenshot(tab: Tab; params: JsonNode): Future[JsonNode] {. ...stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Capture page screenshot.
proc closePageDomain(tab: Tab): owned(Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Tries to close page, running its beforeunload hooks, if any.
proc createIsolatedWorld(tab: Tab; frameId: string): Future[JsonNode] {. ...stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc createIsolatedWorld(tab: Tab; frameId: string; params: JsonNode): Future[ JsonNode] {....stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Creates an isolated world for the given frame.
proc disablePageDomain(tab: Tab): owned(Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Disables page domain notifications.
proc enablePageDomain(tab: Tab): owned(Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Enables page domain notifications.
proc getAppManifest(tab: Tab): Future[JsonNode] {....stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Page.getAppManifest
proc getFrameTree(tab: Tab): Future[JsonNode] {....stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Returns present frame tree structure.
proc getLayoutMetrics(tab: Tab): Future[JsonNode] {....stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
proc handleJavaScriptDialog(tab: Tab; accept: bool): Future[JsonNode] {. ...stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc handleJavaScriptDialog(tab: Tab; accept: bool; params: JsonNode): Future[ JsonNode] {....stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
proc printToPDF(tab: Tab; params: JsonNode): Future[JsonNode] {. ...stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Print page as PDF.
proc reload(tab: Tab): owned(Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc removeScriptToEvaluateOnNewDocument(tab: Tab; identifier: string): owned( Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Page.removeScriptToEvaluateOnNewDocument
Removes given script from the list.
proc setBypassCSP(tab: Tab; enabled: bool): owned(Future[void]) {. ...stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Enable page Content Security Policy by-passing.
proc setDocumentContent(tab: Tab; frameId, html: string): owned(Future[void]) {. ...stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Sets given markup as the document's HTML.
proc setInterceptFileChooserDialog(tab: Tab; enabled: bool): owned( Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Page.setInterceptFileChooserDialog
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.
proc setLifecycleEventsEnabled(tab: Tab; enabled: bool): owned(Future[void]) {. ...stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Page.setLifecycleEventsEnabled
Controls whether page will emit lifecycle events.
proc stopLoading(tab: Tab): owned(Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
-
Force the page stop all navigations and pending resource fetches.