CDPotion.Domain.Page (cdpotion v0.1.0)

Summary

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:

  • frameId:FrameId: 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.

Functions

Link to this function

add_compilation_cache(url, data)

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

Parameters:

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

add_script_to_evaluate_on_load(script_source)

Deprecated, please use addScriptToEvaluateOnNewDocument instead.

Parameters:

  • scriptSource:string: 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)

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

Parameters:

  • source:string: description not provided :(
  • worldName:string: (Optional) 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.
  • includeCommandLineAPI:boolean: (Optional) Specifies whether command line API should be available to the script, defaults to false.
  • runImmediately:boolean: (Optional) If true, runs the script immediately on existing execution contexts or worlds. Default: false.
Link to this function

bring_to_front()

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)

Capture page screenshot.

Parameters:

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

capture_snapshot(format \\ nil)

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:

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

clear_compilation_cache()

Clears seeded compilation cache.

Link to this function

clear_device_metrics_override()

Clears the overridden device metrics.

Link to this function

clear_device_orientation_override()

Clears the overridden Device Orientation.

Link to this function

clear_geolocation_override()

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.

Link to this function

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

Creates an isolated world for the given frame.

Parameters:

  • frameId:FrameId: Id of the frame in which the isolated world should be created.
  • worldName:string: (Optional) An optional name which is reported in the Execution Context.
  • grantUniveralAccess:boolean: (Optional) 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)

Deletes browser cookie with given name, domain and path.

Parameters:

  • cookieName:string: Name of the cookie to remove.
  • url:string: URL to match cooke domain and path.

Disables page domain notifications.

Enables page domain notifications.

Link to this function

generate_test_report(message, group \\ nil)

Generates a report for testing.

Parameters:

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

get_ad_script_id(frame_id)

Parameters:

  • frameId:FrameId: description not provided :(

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

Link to this function

get_app_manifest()

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

Returns present frame tree structure.

Link to this function

get_installability_errors()

Link to this function

get_layout_metrics()

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

Link to this function

get_manifest_icons()

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

Returns navigation history for the current page.

Link to this function

get_origin_trials(frame_id)

Get Origin Trials on given frame.

Parameters:

  • frameId:FrameId: description not provided :(
Link to this function

get_permissions_policy_state(frame_id)

Get Permissions Policy state on given frame.

Parameters:

  • frameId:FrameId: description not provided :(
Link to this function

get_resource_content(frame_id, url)

Returns content of the given resource.

Parameters:

  • frameId:FrameId: Frame id to get resource for.
  • url:string: URL of the resource to get content for.
Link to this function

get_resource_tree()

Returns present frame / resource tree structure.

Link to this function

handle_java_script_dialog(accept, prompt_text \\ nil)

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

Parameters:

  • accept:boolean: Whether to accept or dismiss the dialog.
  • promptText:string: (Optional) 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)

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:

  • scripts:array: description not provided :(
Link to this function

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

Reloads given page optionally ignoring the cache.

Parameters:

  • ignoreCache:boolean: (Optional) If true, browser cache is ignored (as if the user pressed Shift+refresh).
  • scriptToEvaluateOnLoad:string: (Optional) 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)

Deprecated, please use removeScriptToEvaluateOnNewDocument instead.

Parameters:

  • identifier:ScriptIdentifier: description not provided :(
Link to this function

remove_script_to_evaluate_on_new_document(identifier)

Removes given script from the list.

Parameters:

  • identifier:ScriptIdentifier: description not provided :(
Link to this function

reset_navigation_history()

Resets navigation history for the current page.

Link to this function

screencast_frame_ack(session_id)

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

Parameters:

  • sessionId:integer: Frame number.
Link to this function

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

Searches for given string in resource content.

Parameters:

  • frameId:FrameId: Frame id for resource to search in.
  • url:string: URL of the resource to search in.
  • query:string: String to search for.
  • caseSensitive:boolean: (Optional) If true, search is case sensitive.
  • isRegex:boolean: (Optional) If true, treats string parameter as regex.
Link to this function

set_ad_blocking_enabled(enabled)

Enable Chrome's experimental ad filter on all sites.

Parameters:

  • enabled:boolean: Whether to block ads.
Link to this function

set_bypass_csp(enabled)

Enable page Content Security Policy by-passing.

Parameters:

  • enabled:boolean: 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)

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:

  • width:integer: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
  • height:integer: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
  • deviceScaleFactor:number: Overriding device scale factor value. 0 disables the override.
  • mobile:boolean: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
  • scale:number: (Optional) Scale to apply to resulting view image.
  • screenWidth:integer: (Optional) Overriding screen width value in pixels (minimum 0, maximum 10000000).
  • screenHeight:integer: (Optional) Overriding screen height value in pixels (minimum 0, maximum 10000000).
  • positionX:integer: (Optional) Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
  • positionY:integer: (Optional) Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
  • dontSetVisibleSize:boolean: (Optional) Do not set visible view size, rely upon explicit setVisibleSize call.
  • screenOrientation:Emulation.ScreenOrientation: (Optional) Screen orientation override.
  • viewport:Viewport: (Optional) The viewport dimensions and scale. If not set, the override is cleared.
Link to this function

set_device_orientation_override(alpha, beta, gamma)

Overrides the Device Orientation.

Parameters:

  • alpha:number: Mock alpha
  • beta:number: Mock beta
  • gamma:number: Mock gamma
Link to this function

set_document_content(frame_id, html)

Sets given markup as the document's HTML.

Parameters:

  • frameId:FrameId: Frame id to set HTML for.
  • html:string: HTML content to set.
Link to this function

set_download_behavior(behavior, download_path \\ nil)

Set the behavior when downloading a file.

Parameters:

  • behavior:string: Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
  • downloadPath:string: (Optional) 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)

Set generic font families.

Parameters:

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

set_font_sizes(font_sizes)

Set default font sizes.

Parameters:

  • fontSizes:FontSizes: 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)

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

Parameters:

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

set_intercept_file_chooser_dialog(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.

Parameters:

  • enabled:boolean: description not provided :(
Link to this function

set_lifecycle_events_enabled(enabled)

Controls whether page will emit lifecycle events.

Parameters:

  • enabled:boolean: If true, starts emitting lifecycle events.
Link to this function

set_prerendering_allowed(is_allowed)

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:

  • isAllowed:boolean: description not provided :(
Link to this function

set_rph_registration_mode(mode)

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

Parameters:

  • mode:AutoResponseMode: description not provided :(
Link to this function

set_spc_transaction_mode(mode)

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

Parameters:

  • mode:AutoResponseMode: description not provided :(
Link to this function

set_touch_emulation_enabled(enabled, configuration \\ nil)

Toggles mouse event-based touch event emulation.

Parameters:

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

set_web_lifecycle_state(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/

Parameters:

  • state:string: Target lifecycle state
Link to this function

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

Starts sending each frame using the screencastFrame event.

Parameters:

  • format:string: (Optional) Image compression format.
  • quality:integer: (Optional) Compression quality from range [0..100].
  • maxWidth:integer: (Optional) Maximum screenshot width.
  • maxHeight:integer: (Optional) Maximum screenshot height.
  • everyNthFrame:integer: (Optional) Send every n-th frame.

Force the page stop all navigations and pending resource fetches.

Link to this function

stop_screencast()

Stops sending each frame in the screencastFrame.

Link to this function

wait_for_debugger()

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