CDPotion.Domain.Page (cdpotion v0.1.4)

Summary

Types

description not provided :(

Indicates whether a frame has been identified as an ad and why.

Indicates whether a frame has been identified as an ad.

Identifies the bottom-most script which caused the frame to be labelled as an ad.

Error while paring app manifest.

Parsed app manifest properties.

Enum of possible auto-reponse for permisison / prompt dialogs.

description not provided :(

List of not restored reasons for back-forward cache.

Types of not restored reasons for back-forward cache.

description not provided :(

description not provided :(

Per-script compilation cache parameters for Page.produceCompilationCache

Indicates whether the frame is cross-origin isolated and why it is the case.

Javascript dialog type.

Generic font families collection.

Default font sizes.

Information about the Frame on the page.

Unique frame identifier.

Information about the Resource on the page.

Information about the Frame hierarchy along with their cached resources.

Information about the Frame hierarchy.

description not provided :(

The installability error

description not provided :(

Layout viewport position and dimensions.

Navigation history entry.

The type of a frameNavigated event.

description not provided :(

Status for an Origin Trial.

description not provided :(

Origin Trial(https://www.chromium.org/blink/origin-trials) support. Status for an Origin Trial token.

description not provided :(

description not provided :(

description not provided :(

Reason for a permissions policy feature to be disabled.

All Permissions Policy features. This enum should match the one defined in third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5.

description not provided :(

The referring-policy used for the navigation.

Screencast frame metadata.

Font families collection for a script.

Unique script identifier.

Indicates whether the frame is a secure context and why it is the case.

Transition type.

Viewport for capturing screenshot.

Visual viewport position, dimensions, and scale.

Functions

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

Deprecated, please use addScriptToEvaluateOnNewDocument instead.

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

Brings page to front (activates tab).

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

Clears seeded compilation cache.

Clears the overridden device metrics.

Clears the overridden Device Orientation.

Clears the overridden Geolocation Position and Error.

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

Crashes renderer on the IO thread, generates minidumps.

Deletes browser cookie with given name, domain and path.

Disables page domain notifications.

Enables page domain notifications.

Generates a report for testing.

Parameters:

  • (Required) frame_id: description not provided :(

Returns the unique (PWA) app id. Only returns values if the feature flag 'WebAppEnableManifestId' is enabled

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.

Returns present frame tree structure.

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

Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation.

Returns navigation history for the current page.

Get Origin Trials on given frame.

Get Permissions Policy state on given frame.

Returns content of the given resource.

Returns present frame / resource tree structure.

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

Navigates current page to the given history entry.

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.

Reloads given page optionally ignoring the cache.

Deprecated, please use removeScriptToEvaluateOnNewDocument instead.

Removes given script from the list.

Resets navigation history for the current page.

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

Enable Chrome's experimental ad filter on all sites.

Enable page Content Security Policy by-passing.

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).

Overrides the Device Orientation.

Sets given markup as the document's HTML.

Set the behavior when downloading a file.

Set default font sizes.

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

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.

Controls whether page will emit lifecycle events.

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.

Toggles mouse event-based touch event emulation.

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/

Force the page stop all navigations and pending resource fetches.

Stops sending each frame in the screencastFrame.

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

Types

Link to this type

ad_frame_explanation()

@type ad_frame_explanation() ::
  :ParentIsAd | :CreatedByAdScript | :MatchedBlockingRule

description not provided :(

Link to this type

ad_frame_status()

@type ad_frame_status() :: %{
  adFrameType: ad_frame_type(),
  explanations: [ad_frame_explanation()] | nil
}

Indicates whether a frame has been identified as an ad and why.

Link to this type

ad_frame_type()

@type ad_frame_type() :: :none | :child | :root

Indicates whether a frame has been identified as an ad.

Link to this type

ad_script_id()

@type ad_script_id() :: %{
  debuggerId: CDPotion.Domain.Runtime.unique_debugger_id(),
  scriptId: CDPotion.Domain.Runtime.script_id()
}

Identifies the bottom-most script which caused the frame to be labelled as an ad.

Link to this type

app_manifest_error()

@type app_manifest_error() :: %{
  column: integer(),
  critical: integer(),
  line: integer(),
  message: String.t()
}

Error while paring app manifest.

Link to this type

app_manifest_parsed_properties()

@type app_manifest_parsed_properties() :: %{scope: String.t()}

Parsed app manifest properties.

Link to this type

auto_response_mode()

@type auto_response_mode() :: :none | :autoAccept | :autoReject | :autoOptOut

Enum of possible auto-reponse for permisison / prompt dialogs.

Link to this type

back_forward_cache_not_restored_explanation()

@type back_forward_cache_not_restored_explanation() :: %{
  context: String.t() | nil,
  reason: back_forward_cache_not_restored_reason(),
  type: back_forward_cache_not_restored_reason_type()
}

description not provided :(

Link to this type

back_forward_cache_not_restored_explanation_tree()

@type back_forward_cache_not_restored_explanation_tree() :: %{
  children: [back_forward_cache_not_restored_explanation_tree()],
  explanations: [back_forward_cache_not_restored_explanation()],
  url: String.t()
}

description not provided :(

Link to this type

back_forward_cache_not_restored_reason()

@type back_forward_cache_not_restored_reason() ::
  :NotPrimaryMainFrame
  | :BackForwardCacheDisabled
  | :RelatedActiveContentsExist
  | :HTTPStatusNotOK
  | :SchemeNotHTTPOrHTTPS
  | :Loading
  | :WasGrantedMediaAccess
  | :DisableForRenderFrameHostCalled
  | :DomainNotAllowed
  | :HTTPMethodNotGET
  | :SubframeIsNavigating
  | :Timeout
  | :CacheLimit
  | :JavaScriptExecution
  | :RendererProcessKilled
  | :RendererProcessCrashed
  | :SchedulerTrackedFeatureUsed
  | :ConflictingBrowsingInstance
  | :CacheFlushed
  | :ServiceWorkerVersionActivation
  | :SessionRestored
  | :ServiceWorkerPostMessage
  | :EnteredBackForwardCacheBeforeServiceWorkerHostAdded
  | :RenderFrameHostReused_SameSite
  | :RenderFrameHostReused_CrossSite
  | :ServiceWorkerClaim
  | :IgnoreEventAndEvict
  | :HaveInnerContents
  | :TimeoutPuttingInCache
  | :BackForwardCacheDisabledByLowMemory
  | :BackForwardCacheDisabledByCommandLine
  | :NetworkRequestDatapipeDrainedAsBytesConsumer
  | :NetworkRequestRedirected
  | :NetworkRequestTimeout
  | :NetworkExceedsBufferLimit
  | :NavigationCancelledWhileRestoring
  | :NotMostRecentNavigationEntry
  | :BackForwardCacheDisabledForPrerender
  | :UserAgentOverrideDiffers
  | :ForegroundCacheLimit
  | :BrowsingInstanceNotSwapped
  | :BackForwardCacheDisabledForDelegate
  | :UnloadHandlerExistsInMainFrame
  | :UnloadHandlerExistsInSubFrame
  | :ServiceWorkerUnregistration
  | :CacheControlNoStore
  | :CacheControlNoStoreCookieModified
  | :CacheControlNoStoreHTTPOnlyCookieModified
  | :NoResponseHead
  | :Unknown
  | :ActivationNavigationsDisallowedForBug1234857
  | :ErrorDocument
  | :FencedFramesEmbedder
  | :CookieDisabled
  | :HTTPAuthRequired
  | :CookieFlushed
  | :WebSocket
  | :WebTransport
  | :WebRTC
  | :MainResourceHasCacheControlNoStore
  | :MainResourceHasCacheControlNoCache
  | :SubresourceHasCacheControlNoStore
  | :SubresourceHasCacheControlNoCache
  | :ContainsPlugins
  | :DocumentLoaded
  | :DedicatedWorkerOrWorklet
  | :OutstandingNetworkRequestOthers
  | :RequestedMIDIPermission
  | :RequestedAudioCapturePermission
  | :RequestedVideoCapturePermission
  | :RequestedBackForwardCacheBlockedSensors
  | :RequestedBackgroundWorkPermission
  | :BroadcastChannel
  | :WebXR
  | :SharedWorker
  | :WebLocks
  | :WebHID
  | :WebShare
  | :RequestedStorageAccessGrant
  | :WebNfc
  | :OutstandingNetworkRequestFetch
  | :OutstandingNetworkRequestXHR
  | :AppBanner
  | :Printing
  | :WebDatabase
  | :PictureInPicture
  | :Portal
  | :SpeechRecognizer
  | :IdleManager
  | :PaymentManager
  | :SpeechSynthesis
  | :KeyboardLock
  | :WebOTPService
  | :OutstandingNetworkRequestDirectSocket
  | :InjectedJavascript
  | :InjectedStyleSheet
  | :KeepaliveRequest
  | :IndexedDBEvent
  | :Dummy
  | :JsNetworkRequestReceivedCacheControlNoStoreResource
  | :WebRTCSticky
  | :WebTransportSticky
  | :WebSocketSticky
  | :ContentSecurityHandler
  | :ContentWebAuthenticationAPI
  | :ContentFileChooser
  | :ContentSerial
  | :ContentFileSystemAccess
  | :ContentMediaDevicesDispatcherHost
  | :ContentWebBluetooth
  | :ContentWebUSB
  | :ContentMediaSessionService
  | :ContentScreenReader
  | :EmbedderPopupBlockerTabHelper
  | :EmbedderSafeBrowsingTriggeredPopupBlocker
  | :EmbedderSafeBrowsingThreatDetails
  | :EmbedderAppBannerManager
  | :EmbedderDomDistillerViewerSource
  | :EmbedderDomDistillerSelfDeletingRequestDelegate
  | :EmbedderOomInterventionTabHelper
  | :EmbedderOfflinePage
  | :EmbedderChromePasswordManagerClientBindCredentialManager
  | :EmbedderPermissionRequestManager
  | :EmbedderModalDialog
  | :EmbedderExtensions
  | :EmbedderExtensionMessaging
  | :EmbedderExtensionMessagingForOpenPort
  | :EmbedderExtensionSentMessageToCachedFrame

List of not restored reasons for back-forward cache.

Link to this type

back_forward_cache_not_restored_reason_type()

@type back_forward_cache_not_restored_reason_type() ::
  :SupportPending | :PageSupportNeeded | :Circumstantial

Types of not restored reasons for back-forward cache.

Link to this type

client_navigation_disposition()

@type client_navigation_disposition() ::
  :currentTab | :newTab | :newWindow | :download

description not provided :(

Link to this type

client_navigation_reason()

@type client_navigation_reason() ::
  :formSubmissionGet
  | :formSubmissionPost
  | :httpHeaderRefresh
  | :scriptInitiated
  | :metaTagRefresh
  | :pageBlockInterstitial
  | :reload
  | :anchorClick

description not provided :(

Link to this type

compilation_cache_params()

@type compilation_cache_params() :: %{eager: boolean() | nil, url: String.t()}

Per-script compilation cache parameters for Page.produceCompilationCache

Link to this type

cross_origin_isolated_context_type()

@type cross_origin_isolated_context_type() ::
  :Isolated | :NotIsolated | :NotIsolatedFeatureDisabled

Indicates whether the frame is cross-origin isolated and why it is the case.

Link to this type

dialog_type()

@type dialog_type() :: :alert | :confirm | :prompt | :beforeunload

Javascript dialog type.

Link to this type

font_families()

@type font_families() :: %{
  cursive: String.t() | nil,
  fantasy: String.t() | nil,
  fixed: String.t() | nil,
  math: String.t() | nil,
  sansSerif: String.t() | nil,
  serif: String.t() | nil,
  standard: String.t() | nil
}

Generic font families collection.

Link to this type

font_sizes()

@type font_sizes() :: %{fixed: integer() | nil, standard: integer() | nil}

Default font sizes.

@type frame() :: %{
  adFrameStatus: ad_frame_status() | nil,
  crossOriginIsolatedContextType: cross_origin_isolated_context_type(),
  domainAndRegistry: String.t(),
  gatedAPIFeatures: [gated_api_features()],
  id: frame_id(),
  loaderId: CDPotion.Domain.Network.loader_id(),
  mimeType: String.t(),
  name: String.t() | nil,
  parentId: frame_id() | nil,
  secureContextType: secure_context_type(),
  securityOrigin: String.t(),
  unreachableUrl: String.t() | nil,
  url: String.t(),
  urlFragment: String.t() | nil
}

Information about the Frame on the page.

@type frame_id() :: String.t()

Unique frame identifier.

Link to this type

frame_resource()

@type frame_resource() :: %{
  canceled: boolean() | nil,
  contentSize: number() | nil,
  failed: boolean() | nil,
  lastModified: CDPotion.Domain.Network.time_since_epoch() | nil,
  mimeType: String.t(),
  type: CDPotion.Domain.Network.resource_type(),
  url: String.t()
}

Information about the Resource on the page.

Link to this type

frame_resource_tree()

@type frame_resource_tree() :: %{
  childFrames: [frame_resource_tree()] | nil,
  frame: frame(),
  resources: [frame_resource()]
}

Information about the Frame hierarchy along with their cached resources.

Link to this type

frame_tree()

@type frame_tree() :: %{childFrames: [frame_tree()] | nil, frame: frame()}

Information about the Frame hierarchy.

Link to this type

gated_api_features()

@type gated_api_features() ::
  :SharedArrayBuffers
  | :SharedArrayBuffersTransferAllowed
  | :PerformanceMeasureMemory
  | :PerformanceProfile

description not provided :(

Link to this type

installability_error()

@type installability_error() :: %{
  errorArguments: [installability_error_argument()],
  errorId: String.t()
}

The installability error

Link to this type

installability_error_argument()

@type installability_error_argument() :: %{name: String.t(), value: String.t()}

description not provided :(

Link to this type

layout_viewport()

@type layout_viewport() :: %{
  clientHeight: integer(),
  clientWidth: integer(),
  pageX: integer(),
  pageY: integer()
}

Layout viewport position and dimensions.

Link to this type

navigation_entry()

@type navigation_entry() :: %{
  id: integer(),
  title: String.t(),
  transitionType: transition_type(),
  url: String.t(),
  userTypedURL: String.t()
}

Navigation history entry.

Link to this type

navigation_type()

@type navigation_type() :: :Navigation | :BackForwardCacheRestore

The type of a frameNavigated event.

Link to this type

origin_trial()

@type origin_trial() :: %{
  status: origin_trial_status(),
  tokensWithStatus: [origin_trial_token_with_status()],
  trialName: String.t()
}

description not provided :(

Link to this type

origin_trial_status()

@type origin_trial_status() ::
  :Enabled | :ValidTokenNotProvided | :OSNotSupported | :TrialNotAllowed

Status for an Origin Trial.

Link to this type

origin_trial_token()

@type origin_trial_token() :: %{
  expiryTime: CDPotion.Domain.Network.time_since_epoch(),
  isThirdParty: boolean(),
  matchSubDomains: boolean(),
  origin: String.t(),
  trialName: String.t(),
  usageRestriction: origin_trial_usage_restriction()
}

description not provided :(

Link to this type

origin_trial_token_status()

@type origin_trial_token_status() ::
  :Success
  | :NotSupported
  | :Insecure
  | :Expired
  | :WrongOrigin
  | :InvalidSignature
  | :Malformed
  | :WrongVersion
  | :FeatureDisabled
  | :TokenDisabled
  | :FeatureDisabledForUser
  | :UnknownTrial

Origin Trial(https://www.chromium.org/blink/origin-trials) support. Status for an Origin Trial token.

Link to this type

origin_trial_token_with_status()

@type origin_trial_token_with_status() :: %{
  parsedToken: origin_trial_token() | nil,
  rawTokenText: String.t(),
  status: origin_trial_token_status()
}

description not provided :(

Link to this type

origin_trial_usage_restriction()

@type origin_trial_usage_restriction() :: :None | :Subset

description not provided :(

Link to this type

permissions_policy_block_locator()

@type permissions_policy_block_locator() :: %{
  blockReason: permissions_policy_block_reason(),
  frameId: frame_id()
}

description not provided :(

Link to this type

permissions_policy_block_reason()

@type permissions_policy_block_reason() ::
  :Header | :IframeAttribute | :InFencedFrameTree | :InIsolatedApp

Reason for a permissions policy feature to be disabled.

Link to this type

permissions_policy_feature()

@type permissions_policy_feature() ::
  :accelerometer
  | :"ambient-light-sensor"
  | :"attribution-reporting"
  | :autoplay
  | :bluetooth
  | :"browsing-topics"
  | :camera
  | :"ch-dpr"
  | :"ch-device-memory"
  | :"ch-downlink"
  | :"ch-ect"
  | :"ch-prefers-color-scheme"
  | :"ch-prefers-reduced-motion"
  | :"ch-rtt"
  | :"ch-save-data"
  | :"ch-ua"
  | :"ch-ua-arch"
  | :"ch-ua-bitness"
  | :"ch-ua-platform"
  | :"ch-ua-model"
  | :"ch-ua-mobile"
  | :"ch-ua-form-factor"
  | :"ch-ua-full-version"
  | :"ch-ua-full-version-list"
  | :"ch-ua-platform-version"
  | :"ch-ua-wow64"
  | :"ch-viewport-height"
  | :"ch-viewport-width"
  | :"ch-width"
  | :"clipboard-read"
  | :"clipboard-write"
  | :"compute-pressure"
  | :"cross-origin-isolated"
  | :"direct-sockets"
  | :"display-capture"
  | :"document-domain"
  | :"encrypted-media"
  | :"execution-while-out-of-viewport"
  | :"execution-while-not-rendered"
  | :"focus-without-user-activation"
  | :fullscreen
  | :frobulate
  | :gamepad
  | :geolocation
  | :gyroscope
  | :hid
  | :"identity-credentials-get"
  | :"idle-detection"
  | :"interest-cohort"
  | :"join-ad-interest-group"
  | :"keyboard-map"
  | :"local-fonts"
  | :magnetometer
  | :microphone
  | :midi
  | :"otp-credentials"
  | :payment
  | :"picture-in-picture"
  | :"private-aggregation"
  | :"private-state-token-issuance"
  | :"private-state-token-redemption"
  | :"publickey-credentials-get"
  | :"run-ad-auction"
  | :"screen-wake-lock"
  | :serial
  | :"shared-autofill"
  | :"shared-storage"
  | :"shared-storage-select-url"
  | :"smart-card"
  | :"storage-access"
  | :"sync-xhr"
  | :unload
  | :usb
  | :"vertical-scroll"
  | :"web-share"
  | :"window-management"
  | :"window-placement"
  | :"xr-spatial-tracking"

All Permissions Policy features. This enum should match the one defined in third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5.

Link to this type

permissions_policy_feature_state()

@type permissions_policy_feature_state() :: %{
  allowed: boolean(),
  feature: permissions_policy_feature(),
  locator: permissions_policy_block_locator() | nil
}

description not provided :(

Link to this type

referrer_policy()

@type referrer_policy() ::
  :noReferrer
  | :noReferrerWhenDowngrade
  | :origin
  | :originWhenCrossOrigin
  | :sameOrigin
  | :strictOrigin
  | :strictOriginWhenCrossOrigin
  | :unsafeUrl

The referring-policy used for the navigation.

Link to this type

screencast_frame_metadata()

@type screencast_frame_metadata() :: %{
  deviceHeight: number(),
  deviceWidth: number(),
  offsetTop: number(),
  pageScaleFactor: number(),
  scrollOffsetX: number(),
  scrollOffsetY: number(),
  timestamp: CDPotion.Domain.Network.time_since_epoch() | nil
}

Screencast frame metadata.

Link to this type

script_font_families()

@type script_font_families() :: %{fontFamilies: font_families(), script: String.t()}

Font families collection for a script.

Link to this type

script_identifier()

@type script_identifier() :: String.t()

Unique script identifier.

Link to this type

secure_context_type()

@type secure_context_type() ::
  :Secure | :SecureLocalhost | :InsecureScheme | :InsecureAncestor

Indicates whether the frame is a secure context and why it is the case.

Link to this type

transition_type()

@type transition_type() ::
  :link
  | :typed
  | :address_bar
  | :auto_bookmark
  | :auto_subframe
  | :manual_subframe
  | :generated
  | :auto_toplevel
  | :form_submit
  | :reload
  | :keyword
  | :keyword_generated
  | :other

Transition type.

@type viewport() :: %{
  height: number(),
  scale: number(),
  width: number(),
  x: number(),
  y: number()
}

Viewport for capturing screenshot.

Link to this type

visual_viewport()

@type visual_viewport() :: %{
  clientHeight: number(),
  clientWidth: number(),
  offsetX: number(),
  offsetY: number(),
  pageX: number(),
  pageY: number(),
  scale: number(),
  zoom: number() | nil
}

Visual viewport position, dimensions, and scale.

Functions

Link to this function

add_compilation_cache(url, data)

@spec add_compilation_cache(String.t(), String.t()) :: {String.t(), map()}

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

Parameters:

  • (Required) url: description not provided :(
  • (Required) data: Base64-encoded data (Encoded as a base64 string when passed over JSON)
Link to this function

add_script_to_evaluate_on_load(script_source)

@spec add_script_to_evaluate_on_load(String.t()) :: {String.t(), map()}

Deprecated, please use addScriptToEvaluateOnNewDocument instead.

Parameters:

  • (Required) script_source: description not provided :(
Link to this function

add_script_to_evaluate_on_new_document(source, world_name \\ nil, include_command_line_api \\ nil, run_immediately \\ nil)

@spec add_script_to_evaluate_on_new_document(
  String.t(),
  String.t(),
  boolean(),
  boolean()
) ::
  {String.t(), map()}

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

Parameters:

  • (Required) source: description not provided :(
  • (Optional) world_name: If specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted.
  • (Optional) include_command_line_api: Specifies whether command line API should be available to the script, defaults to false.
  • (Optional) run_immediately: If true, runs the script immediately on existing execution contexts or worlds. Default: false.
Link to this function

bring_to_front()

@spec bring_to_front() :: {String.t(), map()}

Brings page to front (activates tab).

Link to this function

capture_screenshot(format \\ nil, quality \\ nil, clip \\ nil, from_surface \\ nil, capture_beyond_viewport \\ nil, optimize_for_speed \\ nil)

@spec capture_screenshot(
  String.t(),
  integer(),
  viewport(),
  boolean(),
  boolean(),
  boolean()
) :: {String.t(), map()}

Capture page screenshot.

Parameters:

  • (Optional) format: Image compression format (defaults to png).
  • (Optional) quality: Compression quality from range [0..100] (jpeg only).
  • (Optional) clip: Capture the screenshot of a given region only.
  • (Optional) from_surface: Capture the screenshot from the surface, rather than the view. Defaults to true.
  • (Optional) capture_beyond_viewport: Capture the screenshot beyond the viewport. Defaults to false.
  • (Optional) optimize_for_speed: Optimize image encoding for speed, not for resulting size (defaults to false)
Link to this function

capture_snapshot(format \\ nil)

@spec capture_snapshot(String.t()) :: {String.t(), map()}

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

Parameters:

  • (Optional) format: Format (defaults to mhtml).
Link to this function

clear_compilation_cache()

@spec clear_compilation_cache() :: {String.t(), map()}

Clears seeded compilation cache.

Link to this function

clear_device_metrics_override()

@spec clear_device_metrics_override() :: {String.t(), map()}

Clears the overridden device metrics.

Link to this function

clear_device_orientation_override()

@spec clear_device_orientation_override() :: {String.t(), map()}

Clears the overridden Device Orientation.

Link to this function

clear_geolocation_override()

@spec clear_geolocation_override() :: {String.t(), map()}

Clears the overridden Geolocation Position and Error.

@spec close() :: {String.t(), map()}

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

@spec crash() :: {String.t(), map()}

Crashes renderer on the IO thread, generates minidumps.

Link to this function

create_isolated_world(frame_id, world_name \\ nil, grant_univeral_access \\ nil)

@spec create_isolated_world(frame_id(), String.t(), boolean()) :: {String.t(), map()}

Creates an isolated world for the given frame.

Parameters:

  • (Required) frame_id: Id of the frame in which the isolated world should be created.
  • (Optional) world_name: An optional name which is reported in the Execution Context.
  • (Optional) grant_univeral_access: Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution.
Link to this function

delete_cookie(cookie_name, url)

@spec delete_cookie(String.t(), String.t()) :: {String.t(), map()}

Deletes browser cookie with given name, domain and path.

Parameters:

  • (Required) cookie_name: Name of the cookie to remove.
  • (Required) url: URL to match cooke domain and path.
@spec disable() :: {String.t(), map()}

Disables page domain notifications.

@spec enable() :: {String.t(), map()}

Enables page domain notifications.

Link to this function

generate_test_report(message, group \\ nil)

@spec generate_test_report(String.t(), String.t()) :: {String.t(), map()}

Generates a report for testing.

Parameters:

  • (Required) message: Message to be displayed in the report.
  • (Optional) group: Specifies the endpoint group to deliver the report to.
Link to this function

get_ad_script_id(frame_id)

@spec get_ad_script_id(frame_id()) :: {String.t(), map()}

Parameters:

  • (Required) frame_id: description not provided :(
@spec get_app_id() :: {String.t(), map()}

Returns the unique (PWA) app id. Only returns values if the feature flag 'WebAppEnableManifestId' is enabled

Link to this function

get_app_manifest()

@spec get_app_manifest() :: {String.t(), map()}
@spec get_cookies() :: {String.t(), map()}

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.

Link to this function

get_frame_tree()

@spec get_frame_tree() :: {String.t(), map()}

Returns present frame tree structure.

Link to this function

get_installability_errors()

@spec get_installability_errors() :: {String.t(), map()}
Link to this function

get_layout_metrics()

@spec get_layout_metrics() :: {String.t(), map()}

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

Link to this function

get_manifest_icons()

@spec get_manifest_icons() :: {String.t(), map()}

Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation.

Link to this function

get_navigation_history()

@spec get_navigation_history() :: {String.t(), map()}

Returns navigation history for the current page.

Link to this function

get_origin_trials(frame_id)

@spec get_origin_trials(frame_id()) :: {String.t(), map()}

Get Origin Trials on given frame.

Parameters:

  • (Required) frame_id: description not provided :(
Link to this function

get_permissions_policy_state(frame_id)

@spec get_permissions_policy_state(frame_id()) :: {String.t(), map()}

Get Permissions Policy state on given frame.

Parameters:

  • (Required) frame_id: description not provided :(
Link to this function

get_resource_content(frame_id, url)

@spec get_resource_content(frame_id(), String.t()) :: {String.t(), map()}

Returns content of the given resource.

Parameters:

  • (Required) frame_id: Frame id to get resource for.
  • (Required) url: URL of the resource to get content for.
Link to this function

get_resource_tree()

@spec get_resource_tree() :: {String.t(), map()}

Returns present frame / resource tree structure.

Link to this function

handle_java_script_dialog(accept, prompt_text \\ nil)

@spec handle_java_script_dialog(boolean(), String.t()) :: {String.t(), map()}

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

Parameters:

  • (Required) accept: Whether to accept or dismiss the dialog.
  • (Optional) prompt_text: The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.
Link to this function

produce_compilation_cache(scripts)

@spec produce_compilation_cache([compilation_cache_params()]) :: {String.t(), map()}

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.

Parameters:

  • (Required) scripts: description not provided :(
Link to this function

reload(ignore_cache \\ nil, script_to_evaluate_on_load \\ nil)

@spec reload(boolean(), String.t()) :: {String.t(), map()}

Reloads given page optionally ignoring the cache.

Parameters:

  • (Optional) ignore_cache: If true, browser cache is ignored (as if the user pressed Shift+refresh).
  • (Optional) script_to_evaluate_on_load: If set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin.
Link to this function

remove_script_to_evaluate_on_load(identifier)

@spec remove_script_to_evaluate_on_load(script_identifier()) :: {String.t(), map()}

Deprecated, please use removeScriptToEvaluateOnNewDocument instead.

Parameters:

  • (Required) identifier: description not provided :(
Link to this function

remove_script_to_evaluate_on_new_document(identifier)

@spec remove_script_to_evaluate_on_new_document(script_identifier()) ::
  {String.t(), map()}

Removes given script from the list.

Parameters:

  • (Required) identifier: description not provided :(
Link to this function

reset_navigation_history()

@spec reset_navigation_history() :: {String.t(), map()}

Resets navigation history for the current page.

Link to this function

screencast_frame_ack(session_id)

@spec screencast_frame_ack(integer()) :: {String.t(), map()}

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

Parameters:

  • (Required) session_id: Frame number.
Link to this function

search_in_resource(frame_id, url, query, case_sensitive \\ nil, is_regex \\ nil)

@spec search_in_resource(
  frame_id(),
  String.t(),
  String.t(),
  boolean(),
  boolean()
) :: {String.t(), map()}

Searches for given string in resource content.

Parameters:

  • (Required) frame_id: Frame id for resource to search in.
  • (Required) url: URL of the resource to search in.
  • (Required) query: String to search for.
  • (Optional) case_sensitive: If true, search is case sensitive.
  • (Optional) is_regex: If true, treats string parameter as regex.
Link to this function

set_ad_blocking_enabled(enabled)

@spec set_ad_blocking_enabled(boolean()) :: {String.t(), map()}

Enable Chrome's experimental ad filter on all sites.

Parameters:

  • (Required) enabled: Whether to block ads.
Link to this function

set_bypass_csp(enabled)

@spec set_bypass_csp(boolean()) :: {String.t(), map()}

Enable page Content Security Policy by-passing.

Parameters:

  • (Required) enabled: Whether to bypass page CSP.
Link to this function

set_device_metrics_override(width, height, device_scale_factor, mobile, scale \\ nil, screen_width \\ nil, screen_height \\ nil, position_x \\ nil, position_y \\ nil, dont_set_visible_size \\ nil, screen_orientation \\ nil, viewport \\ nil)

@spec set_device_metrics_override(
  integer(),
  integer(),
  number(),
  boolean(),
  number(),
  integer(),
  integer(),
  integer(),
  integer(),
  boolean(),
  CDPotion.Domain.Emulation.screen_orientation(),
  viewport()
) :: {String.t(), map()}

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).

Parameters:

  • (Required) width: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
  • (Required) height: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
  • (Required) device_scale_factor: Overriding device scale factor value. 0 disables the override.
  • (Required) mobile: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
  • (Optional) scale: Scale to apply to resulting view image.
  • (Optional) screen_width: Overriding screen width value in pixels (minimum 0, maximum 10000000).
  • (Optional) screen_height: Overriding screen height value in pixels (minimum 0, maximum 10000000).
  • (Optional) position_x: Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
  • (Optional) position_y: Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
  • (Optional) dont_set_visible_size: Do not set visible view size, rely upon explicit setVisibleSize call.
  • (Optional) screen_orientation: Screen orientation override.
  • (Optional) viewport: The viewport dimensions and scale. If not set, the override is cleared.
Link to this function

set_device_orientation_override(alpha, beta, gamma)

@spec set_device_orientation_override(number(), number(), number()) ::
  {String.t(), map()}

Overrides the Device Orientation.

Parameters:

  • (Required) alpha: Mock alpha
  • (Required) beta: Mock beta
  • (Required) gamma: Mock gamma
Link to this function

set_document_content(frame_id, html)

@spec set_document_content(frame_id(), String.t()) :: {String.t(), map()}

Sets given markup as the document's HTML.

Parameters:

  • (Required) frame_id: Frame id to set HTML for.
  • (Required) html: HTML content to set.
Link to this function

set_download_behavior(behavior, download_path \\ nil)

@spec set_download_behavior(String.t(), String.t()) :: {String.t(), map()}

Set the behavior when downloading a file.

Parameters:

  • (Required) behavior: Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
  • (Optional) download_path: The default path to save downloaded files to. This is required if behavior is set to 'allow'
Link to this function

set_font_families(font_families, for_scripts \\ nil)

@spec set_font_families(
  font_families(),
  [script_font_families()]
) :: {String.t(), map()}

Set generic font families.

Parameters:

  • (Required) font_families: Specifies font families to set. If a font family is not specified, it won't be changed.
  • (Optional) for_scripts: Specifies font families to set for individual scripts.
Link to this function

set_font_sizes(font_sizes)

@spec set_font_sizes(font_sizes()) :: {String.t(), map()}

Set default font sizes.

Parameters:

  • (Required) font_sizes: Specifies font sizes to set. If a font size is not specified, it won't be changed.
Link to this function

set_geolocation_override(latitude \\ nil, longitude \\ nil, accuracy \\ nil)

@spec set_geolocation_override(number(), number(), number()) :: {String.t(), map()}

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

Parameters:

  • (Optional) latitude: Mock latitude
  • (Optional) longitude: Mock longitude
  • (Optional) accuracy: Mock accuracy
Link to this function

set_intercept_file_chooser_dialog(enabled)

@spec set_intercept_file_chooser_dialog(boolean()) :: {String.t(), map()}

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.

Parameters:

  • (Required) enabled: description not provided :(
Link to this function

set_lifecycle_events_enabled(enabled)

@spec set_lifecycle_events_enabled(boolean()) :: {String.t(), map()}

Controls whether page will emit lifecycle events.

Parameters:

  • (Required) enabled: If true, starts emitting lifecycle events.
Link to this function

set_prerendering_allowed(is_allowed)

@spec set_prerendering_allowed(boolean()) :: {String.t(), map()}

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.

Parameters:

  • (Required) is_allowed: description not provided :(
Link to this function

set_rph_registration_mode(mode)

@spec set_rph_registration_mode(auto_response_mode()) :: {String.t(), map()}

Extensions for Custom Handlers API: https://html.spec.whatwg.org/multipage/system-state.html#rph-automation

Parameters:

  • (Required) mode: description not provided :(
Link to this function

set_spc_transaction_mode(mode)

@spec set_spc_transaction_mode(auto_response_mode()) :: {String.t(), map()}

Sets the Secure Payment Confirmation transaction mode. https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode

Parameters:

  • (Required) mode: description not provided :(
Link to this function

set_touch_emulation_enabled(enabled, configuration \\ nil)

@spec set_touch_emulation_enabled(boolean(), String.t()) :: {String.t(), map()}

Toggles mouse event-based touch event emulation.

Parameters:

  • (Required) enabled: Whether the touch event emulation should be enabled.
  • (Optional) configuration: Touch/gesture events configuration. Default: current platform.
Link to this function

set_web_lifecycle_state(state)

@spec set_web_lifecycle_state(String.t()) :: {String.t(), map()}

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/

Parameters:

  • (Required) state: Target lifecycle state
Link to this function

start_screencast(format \\ nil, quality \\ nil, max_width \\ nil, max_height \\ nil, every_nth_frame \\ nil)

@spec start_screencast(String.t(), integer(), integer(), integer(), integer()) ::
  {String.t(), map()}

Starts sending each frame using the screencastFrame event.

Parameters:

  • (Optional) format: Image compression format.
  • (Optional) quality: Compression quality from range [0..100].
  • (Optional) max_width: Maximum screenshot width.
  • (Optional) max_height: Maximum screenshot height.
  • (Optional) every_nth_frame: Send every n-th frame.
@spec stop_loading() :: {String.t(), map()}

Force the page stop all navigations and pending resource fetches.

Link to this function

stop_screencast()

@spec stop_screencast() :: {String.t(), map()}

Stops sending each frame in the screencastFrame.

Link to this function

wait_for_debugger()

@spec wait_for_debugger() :: {String.t(), map()}

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