clj-chrome-devtools.commands.page
Actions and events related to the inspected page belong to the page domain.
add-compilation-cache
(add-compilation-cache)
(add-compilation-cache {:as params, :keys [url data]})
(add-compilation-cache connection {:as params, :keys [url data]})
Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.
Parameters map keys:
Key | Description |
---|---|
:url | null |
:data | Base64-encoded data (Encoded as a base64 string when passed over JSON) |
add-script-to-evaluate-on-load
(add-script-to-evaluate-on-load)
(add-script-to-evaluate-on-load {:as params, :keys [script-source]})
(add-script-to-evaluate-on-load connection {:as params, :keys [script-source]})
Deprecated, please use addScriptToEvaluateOnNewDocument instead.
Parameters map keys:
Key | Description |
---|---|
:script-source | null |
Return map keys:
Key | Description |
---|---|
:identifier | Identifier of the added script. |
add-script-to-evaluate-on-new-document
(add-script-to-evaluate-on-new-document)
(add-script-to-evaluate-on-new-document {:as params, :keys [source world-name include-command-line-api]})
(add-script-to-evaluate-on-new-document connection {:as params, :keys [source world-name include-command-line-api]})
Evaluates given script in every frame upon creation (before loading frame’s scripts).
Parameters map keys:
Key | Description |
---|---|
:source | null |
: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)
Return map keys:
Key | Description |
---|---|
:identifier | Identifier of the added script. |
bring-to-front
(bring-to-front)
(bring-to-front {:as params, :keys []})
(bring-to-front connection {:as params, :keys []})
Brings page to front (activates tab).
capture-screenshot
(capture-screenshot)
(capture-screenshot {:as params, :keys [format quality clip from-surface capture-beyond-viewport]})
(capture-screenshot connection {:as params, :keys [format quality clip from-surface capture-beyond-viewport]})
Capture page screenshot.
Parameters map keys:
Key | Description |
---|---|
: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) |
Return map keys:
Key | Description |
---|---|
:data | Base64-encoded image data. (Encoded as a base64 string when passed over JSON) |
capture-snapshot
(capture-snapshot)
(capture-snapshot {:as params, :keys [format]})
(capture-snapshot connection {:as params, :keys [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.
Parameters map keys:
Key | Description |
---|---|
:format | Format (defaults to mhtml). (optional) |
Return map keys:
Key | Description |
---|---|
:data | Serialized page data. |
clear-compilation-cache
(clear-compilation-cache)
(clear-compilation-cache {:as params, :keys []})
(clear-compilation-cache connection {:as params, :keys []})
Clears seeded compilation cache.
clear-device-metrics-override
(clear-device-metrics-override)
(clear-device-metrics-override {:as params, :keys []})
(clear-device-metrics-override connection {:as params, :keys []})
Clears the overridden device metrics.
clear-device-orientation-override
(clear-device-orientation-override)
(clear-device-orientation-override {:as params, :keys []})
(clear-device-orientation-override connection {:as params, :keys []})
Clears the overridden Device Orientation.
clear-geolocation-override
(clear-geolocation-override)
(clear-geolocation-override {:as params, :keys []})
(clear-geolocation-override connection {:as params, :keys []})
Clears the overridden Geolocation Position and Error.
close
(close)
(close {:as params, :keys []})
(close connection {:as params, :keys []})
Tries to close page, running its beforeunload hooks, if any.
crash
(crash)
(crash {:as params, :keys []})
(crash connection {:as params, :keys []})
Crashes renderer on the IO thread, generates minidumps.
create-isolated-world
(create-isolated-world)
(create-isolated-world {:as params, :keys [frame-id world-name grant-univeral-access]})
(create-isolated-world connection {:as params, :keys [frame-id world-name grant-univeral-access]})
Creates an isolated world for the given frame.
Parameters map keys:
Key | Description |
---|---|
:frame-id | Id of the frame in which the isolated world should be created. |
: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. (optional)
Return map keys:
Key | Description |
---|---|
:execution-context-id | Execution context of the isolated world. |
delete-cookie
(delete-cookie)
(delete-cookie {:as params, :keys [cookie-name url]})
(delete-cookie connection {:as params, :keys [cookie-name url]})
Deletes browser cookie with given name, domain and path.
Parameters map keys:
Key | Description |
---|---|
:cookie-name | Name of the cookie to remove. |
:url | URL to match cooke domain and path. |
disable
(disable)
(disable {:as params, :keys []})
(disable connection {:as params, :keys []})
Disables page domain notifications.
enable
(enable)
(enable {:as params, :keys []})
(enable connection {:as params, :keys []})
Enables page domain notifications.
generate-test-report
(generate-test-report)
(generate-test-report {:as params, :keys [message group]})
(generate-test-report connection {:as params, :keys [message group]})
Generates a report for testing.
Parameters map keys:
Key | Description |
---|---|
:message | Message to be displayed in the report. |
:group | Specifies the endpoint group to deliver the report to. (optional) |
get-app-id
(get-app-id)
(get-app-id {:as params, :keys []})
(get-app-id connection {:as params, :keys []})
Returns the unique (PWA) app id. Only returns values if the feature flag ‘WebAppEnableManifestId’ is enabled
Return map keys:
Key | Description |
---|---|
:app-id | App id, either from manifest’s id attribute or computed from start_url (optional) |
:recommended-id | Recommendation for manifest’s id attribute to match current id computed from start_url (optional) |
get-app-manifest
(get-app-manifest)
(get-app-manifest {:as params, :keys []})
(get-app-manifest connection {:as params, :keys []})
Return map keys:
Key | Description |
---|---|
:url | Manifest location. |
:errors | null |
:data | Manifest content. (optional) |
:parsed | Parsed manifest properties (optional) |
get-cookies
(get-cookies)
(get-cookies {:as params, :keys []})
(get-cookies connection {:as params, :keys []})
Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies
field.
Return map keys:
Key | Description |
---|---|
:cookies | Array of cookie objects. |
get-frame-tree
(get-frame-tree)
(get-frame-tree {:as params, :keys []})
(get-frame-tree connection {:as params, :keys []})
Returns present frame tree structure.
Return map keys:
Key | Description |
---|---|
:frame-tree | Present frame tree structure. |
get-installability-errors
(get-installability-errors)
(get-installability-errors {:as params, :keys []})
(get-installability-errors connection {:as params, :keys []})
Return map keys:
Key | Description |
---|---|
:installability-errors | null |
get-layout-metrics
(get-layout-metrics)
(get-layout-metrics {:as params, :keys []})
(get-layout-metrics connection {:as params, :keys []})
Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
Return map keys:
Key | Description |
---|---|
:layout-viewport | Deprecated metrics relating to the layout viewport. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssLayoutViewport instead. |
:visual-viewport | Deprecated metrics relating to the visual viewport. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssVisualViewport instead. |
:content-size | Deprecated size of scrollable area. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssContentSize instead. |
:css-layout-viewport | Metrics relating to the layout viewport in CSS pixels. |
:css-visual-viewport | Metrics relating to the visual viewport in CSS pixels. |
:css-content-size | Size of scrollable area in CSS pixels. |
get-manifest-icons
(get-manifest-icons)
(get-manifest-icons {:as params, :keys []})
(get-manifest-icons connection {:as params, :keys []})
Return map keys:
Key | Description |
---|---|
:primary-icon | null (optional) |
get-origin-trials
(get-origin-trials)
(get-origin-trials {:as params, :keys [frame-id]})
(get-origin-trials connection {:as params, :keys [frame-id]})
Get Origin Trials on given frame.
Parameters map keys:
Key | Description |
---|---|
:frame-id | null |
Return map keys:
Key | Description |
---|---|
:origin-trials | null |
get-permissions-policy-state
(get-permissions-policy-state)
(get-permissions-policy-state {:as params, :keys [frame-id]})
(get-permissions-policy-state connection {:as params, :keys [frame-id]})
Get Permissions Policy state on given frame.
Parameters map keys:
Key | Description |
---|---|
:frame-id | null |
Return map keys:
Key | Description |
---|---|
:states | null |
get-resource-content
(get-resource-content)
(get-resource-content {:as params, :keys [frame-id url]})
(get-resource-content connection {:as params, :keys [frame-id url]})
Returns content of the given resource.
Parameters map keys:
Key | Description |
---|---|
:frame-id | Frame id to get resource for. |
:url | URL of the resource to get content for. |
Return map keys:
Key | Description |
---|---|
:content | Resource content. |
:base64-encoded | True, if content was served as base64. |
get-resource-tree
(get-resource-tree)
(get-resource-tree {:as params, :keys []})
(get-resource-tree connection {:as params, :keys []})
Returns present frame / resource tree structure.
Return map keys:
Key | Description |
---|---|
:frame-tree | Present frame / resource tree structure. |
handle-java-script-dialog
(handle-java-script-dialog)
(handle-java-script-dialog {:as params, :keys [accept prompt-text]})
(handle-java-script-dialog connection {:as params, :keys [accept prompt-text]})
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
Parameters map keys:
Key | Description |
---|---|
:accept | Whether to accept or dismiss the dialog. |
:prompt-text | The text to enter into the dialog prompt before accepting. Used only if this is a prompt |
dialog. (optional)
print-to-pdf
(print-to-pdf)
(print-to-pdf {:as params, :keys [landscape display-header-footer print-background scale paper-width paper-height margin-top margin-bottom margin-left margin-right page-ranges ignore-invalid-page-ranges header-template footer-template prefer-css-page-size transfer-mode]})
(print-to-pdf connection {:as params, :keys [landscape display-header-footer print-background scale paper-width paper-height margin-top margin-bottom margin-left margin-right page-ranges ignore-invalid-page-ranges header-template footer-template prefer-css-page-size transfer-mode]})
Print page as PDF.
Parameters map keys:
Key | Description |
---|---|
:landscape | Paper orientation. Defaults to false. (optional) |
:display-header-footer | Display header and footer. Defaults to false. (optional) |
:print-background | Print background graphics. Defaults to false. (optional) |
:scale | Scale of the webpage rendering. Defaults to 1. (optional) |
:paper-width | Paper width in inches. Defaults to 8.5 inches. (optional) |
:paper-height | Paper height in inches. Defaults to 11 inches. (optional) |
:margin-top | Top margin in inches. Defaults to 1cm (~0.4 inches). (optional) |
:margin-bottom | Bottom margin in inches. Defaults to 1cm (~0.4 inches). (optional) |
:margin-left | Left margin in inches. Defaults to 1cm (~0.4 inches). (optional) |
:margin-right | Right margin in inches. Defaults to 1cm (~0.4 inches). (optional) |
:page-ranges | Paper ranges to print, e.g., ‘1-5, 8, 11-13’. Defaults to the empty string, which means |
print all pages. (optional) :ignore-invalid-page-ranges | Whether to silently ignore invalid but successfully parsed page ranges, such as ‘3-2’. Defaults to false. (optional) :header-template | HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - date
: formatted print date - title
: document title - url
: document location - pageNumber
: current page number - totalPages
: total pages in the document
For example, <span class=title></span>
would generate span containing the title. (optional) :footer-template | HTML template for the print footer. Should use the same format as the headerTemplate
. (optional) :prefer-css-page-size | Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size. (optional) :transfer-mode | return as stream (optional)
Return map keys:
Key | Description | ||
---|---|---|---|
:data | Base64-encoded pdf data. Empty if | returnAsStream | is specified. (Encoded as a base64 string when passed over JSON) |
:stream | A handle of the stream that holds resulting PDF data. (optional) |
produce-compilation-cache
(produce-compilation-cache)
(produce-compilation-cache {:as params, :keys [scripts]})
(produce-compilation-cache connection {:as params, :keys [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 map keys:
Key | Description |
---|---|
:scripts | null |
reload
(reload)
(reload {:as params, :keys [ignore-cache script-to-evaluate-on-load]})
(reload connection {:as params, :keys [ignore-cache script-to-evaluate-on-load]})
Reloads given page optionally ignoring the cache.
Parameters map keys:
Key | Description |
---|---|
: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. (optional)
remove-script-to-evaluate-on-load
(remove-script-to-evaluate-on-load)
(remove-script-to-evaluate-on-load {:as params, :keys [identifier]})
(remove-script-to-evaluate-on-load connection {:as params, :keys [identifier]})
Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
Parameters map keys:
Key | Description |
---|---|
:identifier | null |
remove-script-to-evaluate-on-new-document
(remove-script-to-evaluate-on-new-document)
(remove-script-to-evaluate-on-new-document {:as params, :keys [identifier]})
(remove-script-to-evaluate-on-new-document connection {:as params, :keys [identifier]})
Removes given script from the list.
Parameters map keys:
Key | Description |
---|---|
:identifier | null |
screencast-frame-ack
(screencast-frame-ack)
(screencast-frame-ack {:as params, :keys [session-id]})
(screencast-frame-ack connection {:as params, :keys [session-id]})
Acknowledges that a screencast frame has been received by the frontend.
Parameters map keys:
Key | Description |
---|---|
:session-id | Frame number. |
search-in-resource
(search-in-resource)
(search-in-resource {:as params, :keys [frame-id url query case-sensitive is-regex]})
(search-in-resource connection {:as params, :keys [frame-id url query case-sensitive is-regex]})
Searches for given string in resource content.
Parameters map keys:
Key | Description |
---|---|
:frame-id | Frame id for resource to search in. |
:url | URL of the resource to search in. |
:query | String to search for. |
:case-sensitive | If true, search is case sensitive. (optional) |
:is-regex | If true, treats string parameter as regex. (optional) |
Return map keys:
Key | Description |
---|---|
:result | List of search matches. |
set-ad-blocking-enabled
(set-ad-blocking-enabled)
(set-ad-blocking-enabled {:as params, :keys [enabled]})
(set-ad-blocking-enabled connection {:as params, :keys [enabled]})
Enable Chrome’s experimental ad filter on all sites.
Parameters map keys:
Key | Description |
---|---|
:enabled | Whether to block ads. |
set-bypass-csp
(set-bypass-csp)
(set-bypass-csp {:as params, :keys [enabled]})
(set-bypass-csp connection {:as params, :keys [enabled]})
Enable page Content Security Policy by-passing.
Parameters map keys:
Key | Description |
---|---|
:enabled | Whether to bypass page CSP. |
set-device-metrics-override
(set-device-metrics-override)
(set-device-metrics-override {:as params, :keys [width height device-scale-factor mobile scale screen-width screen-height position-x position-y dont-set-visible-size screen-orientation viewport]})
(set-device-metrics-override connection {:as params, :keys [width height device-scale-factor mobile scale screen-width screen-height position-x position-y dont-set-visible-size screen-orientation viewport]})
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 map keys:
Key | Description |
---|---|
:width | Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. |
:height | Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. |
:device-scale-factor | Overriding device scale factor value. 0 disables the override. |
:mobile | Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text |
autosizing and more. :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. (optional)
set-device-orientation-override
(set-device-orientation-override)
(set-device-orientation-override {:as params, :keys [alpha beta gamma]})
(set-device-orientation-override connection {:as params, :keys [alpha beta gamma]})
Overrides the Device Orientation.
Parameters map keys:
Key | Description |
---|---|
:alpha | Mock alpha |
:beta | Mock beta |
:gamma | Mock gamma |
set-document-content
(set-document-content)
(set-document-content {:as params, :keys [frame-id html]})
(set-document-content connection {:as params, :keys [frame-id html]})
Sets given markup as the document’s HTML.
Parameters map keys:
Key | Description |
---|---|
:frame-id | Frame id to set HTML for. |
:html | HTML content to set. |
set-download-behavior
(set-download-behavior)
(set-download-behavior {:as params, :keys [behavior download-path]})
(set-download-behavior connection {:as params, :keys [behavior download-path]})
Set the behavior when downloading a file.
Parameters map keys:
Key | Description |
---|---|
:behavior | Whether to allow all or deny all download requests, or use default Chrome behavior if |
available (otherwise deny). :download-path | The default path to save downloaded files to. This is required if behavior is set to ‘allow’ (optional)
set-font-families
(set-font-families)
(set-font-families {:as params, :keys [font-families for-scripts]})
(set-font-families connection {:as params, :keys [font-families for-scripts]})
Set generic font families.
Parameters map keys:
Key | Description |
---|---|
:font-families | Specifies font families to set. If a font family is not specified, it won’t be changed. |
:for-scripts | Specifies font families to set for individual scripts. (optional) |
set-font-sizes
(set-font-sizes)
(set-font-sizes {:as params, :keys [font-sizes]})
(set-font-sizes connection {:as params, :keys [font-sizes]})
Set default font sizes.
Parameters map keys:
Key | Description |
---|---|
:font-sizes | Specifies font sizes to set. If a font size is not specified, it won’t be changed. |
set-geolocation-override
(set-geolocation-override)
(set-geolocation-override {:as params, :keys [latitude longitude accuracy]})
(set-geolocation-override connection {:as params, :keys [latitude longitude accuracy]})
Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
Parameters map keys:
Key | Description |
---|---|
:latitude | Mock latitude (optional) |
:longitude | Mock longitude (optional) |
:accuracy | Mock accuracy (optional) |
set-intercept-file-chooser-dialog
(set-intercept-file-chooser-dialog)
(set-intercept-file-chooser-dialog {:as params, :keys [enabled]})
(set-intercept-file-chooser-dialog connection {:as params, :keys [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 map keys:
Key | Description |
---|---|
:enabled | null |
set-lifecycle-events-enabled
(set-lifecycle-events-enabled)
(set-lifecycle-events-enabled {:as params, :keys [enabled]})
(set-lifecycle-events-enabled connection {:as params, :keys [enabled]})
Controls whether page will emit lifecycle events.
Parameters map keys:
Key | Description |
---|---|
:enabled | If true, starts emitting lifecycle events. |
set-spc-transaction-mode
(set-spc-transaction-mode)
(set-spc-transaction-mode {:as params, :keys [mode]})
(set-spc-transaction-mode connection {:as params, :keys [mode]})
Sets the Secure Payment Confirmation transaction mode. https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode
Parameters map keys:
Key | Description |
---|---|
:mode | null |
set-touch-emulation-enabled
(set-touch-emulation-enabled)
(set-touch-emulation-enabled {:as params, :keys [enabled configuration]})
(set-touch-emulation-enabled connection {:as params, :keys [enabled configuration]})
Toggles mouse event-based touch event emulation.
Parameters map keys:
Key | Description |
---|---|
:enabled | Whether the touch event emulation should be enabled. |
:configuration | Touch/gesture events configuration. Default: current platform. (optional) |
set-web-lifecycle-state
(set-web-lifecycle-state)
(set-web-lifecycle-state {:as params, :keys [state]})
(set-web-lifecycle-state connection {:as params, :keys [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 map keys:
Key | Description |
---|---|
:state | Target lifecycle state |
start-screencast
(start-screencast)
(start-screencast {:as params, :keys [format quality max-width max-height every-nth-frame]})
(start-screencast connection {:as params, :keys [format quality max-width max-height every-nth-frame]})
Starts sending each frame using the screencastFrame
event.
Parameters map keys:
Key | Description |
---|---|
: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. (optional) |
stop-loading
(stop-loading)
(stop-loading {:as params, :keys []})
(stop-loading connection {:as params, :keys []})
Force the page stop all navigations and pending resource fetches.
stop-screencast
(stop-screencast)
(stop-screencast {:as params, :keys []})
(stop-screencast connection {:as params, :keys []})
Stops sending each frame in the screencastFrame
.
wait-for-debugger
(wait-for-debugger)
(wait-for-debugger {:as params, :keys []})
(wait-for-debugger connection {:as params, :keys []})
Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.