Skip to main content

cdp_driver/methods/
page.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! Actions and events related to the inspected page belong to the page
5//! domain.
6//!
7//! Method names for the `Page` domain, for use with
8//! [`CdpClient::call`](crate::CdpClient::call).
9
10/// Deprecated, please use addScriptToEvaluateOnNewDocument instead.
11///
12/// Deprecated in the protocol.
13/// Experimental: may change without notice.
14///
15/// Parameters:
16/// - `scriptSource`: string
17///
18/// Returns: `identifier`
19pub const ADD_SCRIPT_TO_EVALUATE_ON_LOAD: &str = "Page.addScriptToEvaluateOnLoad";
20
21/// Evaluates given script in every frame upon creation (before loading
22/// frame's scripts).
23///
24/// Parameters:
25/// - `source`: string
26/// - `worldName`: string (optional)
27/// - `includeCommandLineAPI`: boolean (optional)
28/// - `runImmediately`: boolean (optional)
29///
30/// Returns: `identifier`
31pub const ADD_SCRIPT_TO_EVALUATE_ON_NEW_DOCUMENT: &str = "Page.addScriptToEvaluateOnNewDocument";
32
33/// Brings page to front (activates tab).
34pub const BRING_TO_FRONT: &str = "Page.bringToFront";
35
36/// Capture page screenshot.
37///
38/// Parameters:
39/// - `format`: string (optional)
40/// - `quality`: integer (optional)
41/// - `clip`: Viewport (optional)
42/// - `fromSurface`: boolean (optional)
43/// - `captureBeyondViewport`: boolean (optional)
44/// - `optimizeForSpeed`: boolean (optional)
45///
46/// Returns: `data`
47pub const CAPTURE_SCREENSHOT: &str = "Page.captureScreenshot";
48
49/// Returns a snapshot of the page as a string. For MHTML format, the
50/// serialization includes iframes, shadow DOM, external resources, and
51/// element-inline styles.
52///
53/// Experimental: may change without notice.
54///
55/// Parameters:
56/// - `format`: string (optional)
57///
58/// Returns: `data`
59pub const CAPTURE_SNAPSHOT: &str = "Page.captureSnapshot";
60
61/// Clears the overridden device metrics.
62///
63/// Deprecated in the protocol.
64/// Experimental: may change without notice.
65pub const CLEAR_DEVICE_METRICS_OVERRIDE: &str = "Page.clearDeviceMetricsOverride";
66
67/// Clears the overridden Device Orientation.
68///
69/// Deprecated in the protocol.
70/// Experimental: may change without notice.
71pub const CLEAR_DEVICE_ORIENTATION_OVERRIDE: &str = "Page.clearDeviceOrientationOverride";
72
73/// Clears the overridden Geolocation Position and Error.
74///
75/// Deprecated in the protocol.
76pub const CLEAR_GEOLOCATION_OVERRIDE: &str = "Page.clearGeolocationOverride";
77
78/// Creates an isolated world for the given frame.
79///
80/// Parameters:
81/// - `frameId`: FrameId
82/// - `worldName`: string (optional)
83/// - `grantUniveralAccess`: boolean (optional)
84/// - `contentSecurityPolicy`: string (optional)
85///
86/// Returns: `executionContextId`
87pub const CREATE_ISOLATED_WORLD: &str = "Page.createIsolatedWorld";
88
89/// Deletes browser cookie with given name, domain and path.
90///
91/// Deprecated in the protocol.
92/// Experimental: may change without notice.
93///
94/// Parameters:
95/// - `cookieName`: string
96/// - `url`: string
97pub const DELETE_COOKIE: &str = "Page.deleteCookie";
98
99/// Disables page domain notifications.
100pub const DISABLE: &str = "Page.disable";
101
102/// Enables page domain notifications.
103///
104/// Parameters:
105/// - `enableFileChooserOpenedEvent`: boolean (optional)
106pub const ENABLE: &str = "Page.enable";
107
108/// Gets the processed manifest for this current document. This API always
109/// waits for the manifest to be loaded. If manifestId is provided, and it
110/// does not match the manifest of the current document, this API errors out.
111/// If there is not a loaded page, this API errors out immediately.
112///
113/// Parameters:
114/// - `manifestId`: string (optional)
115///
116/// Returns: `url`, `errors`, `data`, `parsed`, `manifest`
117pub const GET_APP_MANIFEST: &str = "Page.getAppManifest";
118
119/// `Page.getInstallabilityErrors`
120///
121/// Experimental: may change without notice.
122///
123/// Returns: `installabilityErrors`
124pub const GET_INSTALLABILITY_ERRORS: &str = "Page.getInstallabilityErrors";
125
126/// Deprecated because it's not guaranteed that the returned icon is in fact
127/// the one used for PWA installation.
128///
129/// Deprecated in the protocol.
130/// Experimental: may change without notice.
131///
132/// Returns: `primaryIcon`
133pub const GET_MANIFEST_ICONS: &str = "Page.getManifestIcons";
134
135/// Returns the unique (PWA) app id. Only returns values if the feature flag
136/// 'WebAppEnableManifestId' is enabled
137///
138/// Experimental: may change without notice.
139///
140/// Returns: `appId`, `recommendedId`
141pub const GET_APP_ID: &str = "Page.getAppId";
142
143/// `Page.getAdScriptAncestry`
144///
145/// Experimental: may change without notice.
146///
147/// Parameters:
148/// - `frameId`: FrameId
149///
150/// Returns: `adScriptAncestry`
151pub const GET_AD_SCRIPT_ANCESTRY: &str = "Page.getAdScriptAncestry";
152
153/// Returns present frame tree structure.
154///
155/// Returns: `frameTree`
156pub const GET_FRAME_TREE: &str = "Page.getFrameTree";
157
158/// Returns metrics relating to the layouting of the page, such as viewport
159/// bounds/scale.
160///
161/// Returns: `layoutViewport`, `visualViewport`, `contentSize`, `cssLayoutViewport`, `cssVisualViewport`, `cssContentSize`
162pub const GET_LAYOUT_METRICS: &str = "Page.getLayoutMetrics";
163
164/// Returns navigation history for the current page.
165///
166/// Returns: `currentIndex`, `entries`
167pub const GET_NAVIGATION_HISTORY: &str = "Page.getNavigationHistory";
168
169/// Resets navigation history for the current page.
170pub const RESET_NAVIGATION_HISTORY: &str = "Page.resetNavigationHistory";
171
172/// Returns content of the given resource.
173///
174/// Experimental: may change without notice.
175///
176/// Parameters:
177/// - `frameId`: FrameId
178/// - `url`: string
179///
180/// Returns: `content`, `base64Encoded`
181pub const GET_RESOURCE_CONTENT: &str = "Page.getResourceContent";
182
183/// Returns present frame / resource tree structure.
184///
185/// Experimental: may change without notice.
186///
187/// Returns: `frameTree`
188pub const GET_RESOURCE_TREE: &str = "Page.getResourceTree";
189
190/// Accepts or dismisses a JavaScript initiated dialog (alert, confirm,
191/// prompt, or onbeforeunload).
192///
193/// Parameters:
194/// - `accept`: boolean
195/// - `promptText`: string (optional)
196pub const HANDLE_JAVA_SCRIPT_DIALOG: &str = "Page.handleJavaScriptDialog";
197
198/// Navigates current page to the given URL.
199///
200/// Parameters:
201/// - `url`: string
202/// - `referrer`: string (optional)
203/// - `transitionType`: TransitionType (optional)
204/// - `frameId`: FrameId (optional)
205/// - `referrerPolicy`: ReferrerPolicy (optional)
206///
207/// Returns: `frameId`, `loaderId`, `errorText`, `isDownload`
208pub const NAVIGATE: &str = "Page.navigate";
209
210/// Navigates current page to the given history entry.
211///
212/// Parameters:
213/// - `entryId`: integer
214pub const NAVIGATE_TO_HISTORY_ENTRY: &str = "Page.navigateToHistoryEntry";
215
216/// Print page as PDF.
217///
218/// Parameters:
219/// - `landscape`: boolean (optional)
220/// - `displayHeaderFooter`: boolean (optional)
221/// - `printBackground`: boolean (optional)
222/// - `scale`: number (optional)
223/// - `paperWidth`: number (optional)
224/// - `paperHeight`: number (optional)
225/// - `marginTop`: number (optional)
226/// - `marginBottom`: number (optional)
227/// - `marginLeft`: number (optional)
228/// - `marginRight`: number (optional)
229/// - `pageRanges`: string (optional)
230/// - `headerTemplate`: string (optional)
231/// - `footerTemplate`: string (optional)
232/// - `preferCSSPageSize`: boolean (optional)
233/// - `transferMode`: string (optional)
234/// - `generateTaggedPDF`: boolean (optional)
235/// - `generateDocumentOutline`: boolean (optional)
236///
237/// Returns: `data`, `stream`
238pub const PRINT_TO_PDF: &str = "Page.printToPDF";
239
240/// Reloads given page optionally ignoring the cache.
241///
242/// Parameters:
243/// - `ignoreCache`: boolean (optional)
244/// - `scriptToEvaluateOnLoad`: string (optional)
245/// - `loaderId`: Network.LoaderId (optional)
246pub const RELOAD: &str = "Page.reload";
247
248/// Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
249///
250/// Deprecated in the protocol.
251/// Experimental: may change without notice.
252///
253/// Parameters:
254/// - `identifier`: ScriptIdentifier
255pub const REMOVE_SCRIPT_TO_EVALUATE_ON_LOAD: &str = "Page.removeScriptToEvaluateOnLoad";
256
257/// Removes given script from the list.
258///
259/// Parameters:
260/// - `identifier`: ScriptIdentifier
261pub const REMOVE_SCRIPT_TO_EVALUATE_ON_NEW_DOCUMENT: &str =
262    "Page.removeScriptToEvaluateOnNewDocument";
263
264/// Acknowledges that a screencast frame has been received by the frontend.
265///
266/// Experimental: may change without notice.
267///
268/// Parameters:
269/// - `sessionId`: integer
270pub const SCREENCAST_FRAME_ACK: &str = "Page.screencastFrameAck";
271
272/// Searches for given string in resource content.
273///
274/// Experimental: may change without notice.
275///
276/// Parameters:
277/// - `frameId`: FrameId
278/// - `url`: string
279/// - `query`: string
280/// - `caseSensitive`: boolean (optional)
281/// - `isRegex`: boolean (optional)
282///
283/// Returns: `result`
284pub const SEARCH_IN_RESOURCE: &str = "Page.searchInResource";
285
286/// Enable Chrome's experimental ad filter on all sites.
287///
288/// Experimental: may change without notice.
289///
290/// Parameters:
291/// - `enabled`: boolean
292pub const SET_AD_BLOCKING_ENABLED: &str = "Page.setAdBlockingEnabled";
293
294/// Enable page Content Security Policy by-passing.
295///
296/// Parameters:
297/// - `enabled`: boolean
298pub const SET_BYPASS_CSP: &str = "Page.setBypassCSP";
299
300/// Get Permissions Policy state on given frame.
301///
302/// Experimental: may change without notice.
303///
304/// Parameters:
305/// - `frameId`: FrameId
306///
307/// Returns: `states`
308pub const GET_PERMISSIONS_POLICY_STATE: &str = "Page.getPermissionsPolicyState";
309
310/// Get Origin Trials on given frame.
311///
312/// Experimental: may change without notice.
313///
314/// Parameters:
315/// - `frameId`: FrameId
316///
317/// Returns: `originTrials`
318pub const GET_ORIGIN_TRIALS: &str = "Page.getOriginTrials";
319
320/// Overrides the values of device screen dimensions (window.screen.width,
321/// window.screen.height, window.innerWidth, window.innerHeight, and
322/// "device-width"/"device-height"-related CSS media query results).
323///
324/// Deprecated in the protocol.
325/// Experimental: may change without notice.
326///
327/// Parameters:
328/// - `width`: integer
329/// - `height`: integer
330/// - `deviceScaleFactor`: number
331/// - `mobile`: boolean
332/// - `scale`: number (optional)
333/// - `screenWidth`: integer (optional)
334/// - `screenHeight`: integer (optional)
335/// - `positionX`: integer (optional)
336/// - `positionY`: integer (optional)
337/// - `dontSetVisibleSize`: boolean (optional)
338/// - `screenOrientation`: Emulation.ScreenOrientation (optional)
339/// - `viewport`: Viewport (optional)
340pub const SET_DEVICE_METRICS_OVERRIDE: &str = "Page.setDeviceMetricsOverride";
341
342/// Overrides the Device Orientation.
343///
344/// Deprecated in the protocol.
345/// Experimental: may change without notice.
346///
347/// Parameters:
348/// - `alpha`: number
349/// - `beta`: number
350/// - `gamma`: number
351pub const SET_DEVICE_ORIENTATION_OVERRIDE: &str = "Page.setDeviceOrientationOverride";
352
353/// Set generic font families.
354///
355/// Experimental: may change without notice.
356///
357/// Parameters:
358/// - `fontFamilies`: FontFamilies
359/// - `forScripts`: array (optional)
360pub const SET_FONT_FAMILIES: &str = "Page.setFontFamilies";
361
362/// Set default font sizes.
363///
364/// Experimental: may change without notice.
365///
366/// Parameters:
367/// - `fontSizes`: FontSizes
368pub const SET_FONT_SIZES: &str = "Page.setFontSizes";
369
370/// Sets given markup as the document's HTML.
371///
372/// Parameters:
373/// - `frameId`: FrameId
374/// - `html`: string
375pub const SET_DOCUMENT_CONTENT: &str = "Page.setDocumentContent";
376
377/// Set the behavior when downloading a file.
378///
379/// Deprecated in the protocol.
380/// Experimental: may change without notice.
381///
382/// Parameters:
383/// - `behavior`: string
384/// - `downloadPath`: string (optional)
385pub const SET_DOWNLOAD_BEHAVIOR: &str = "Page.setDownloadBehavior";
386
387/// Overrides the Geolocation Position or Error. Omitting any of the
388/// parameters emulates position unavailable.
389///
390/// Deprecated in the protocol.
391///
392/// Parameters:
393/// - `latitude`: number (optional)
394/// - `longitude`: number (optional)
395/// - `accuracy`: number (optional)
396pub const SET_GEOLOCATION_OVERRIDE: &str = "Page.setGeolocationOverride";
397
398/// Controls whether page will emit lifecycle events.
399///
400/// Parameters:
401/// - `enabled`: boolean
402pub const SET_LIFECYCLE_EVENTS_ENABLED: &str = "Page.setLifecycleEventsEnabled";
403
404/// Toggles mouse event-based touch event emulation.
405///
406/// Deprecated in the protocol.
407/// Experimental: may change without notice.
408///
409/// Parameters:
410/// - `enabled`: boolean
411/// - `configuration`: string (optional)
412pub const SET_TOUCH_EMULATION_ENABLED: &str = "Page.setTouchEmulationEnabled";
413
414/// Starts sending each frame using the `screencastFrame` event.
415///
416/// Experimental: may change without notice.
417///
418/// Parameters:
419/// - `format`: string (optional)
420/// - `quality`: integer (optional)
421/// - `maxWidth`: integer (optional)
422/// - `maxHeight`: integer (optional)
423/// - `everyNthFrame`: integer (optional)
424pub const START_SCREENCAST: &str = "Page.startScreencast";
425
426/// Starts screencast video recording.
427///
428/// Experimental: may change without notice.
429///
430/// Parameters:
431/// - `audio`: boolean (optional)
432/// - `maxWidth`: integer (optional)
433/// - `maxHeight`: integer (optional)
434/// - `frameRate`: integer (optional)
435///
436/// Returns: `stream`
437pub const START_SCREEN_RECORDING: &str = "Page.startScreenRecording";
438
439/// Stops screencast video recording.
440///
441/// Experimental: may change without notice.
442///
443/// Returns: `stream`
444pub const STOP_SCREEN_RECORDING: &str = "Page.stopScreenRecording";
445
446/// Force the page stop all navigations and pending resource fetches.
447pub const STOP_LOADING: &str = "Page.stopLoading";
448
449/// Crashes renderer on the IO thread, generates minidumps.
450///
451/// Experimental: may change without notice.
452pub const CRASH: &str = "Page.crash";
453
454/// Tries to close page, running its beforeunload hooks, if any.
455pub const CLOSE: &str = "Page.close";
456
457/// Tries to update the web lifecycle state of the page. It will transition
458/// the page to the given state according to:
459/// <https://github.com/WICG/web-lifecycle/>
460///
461/// Experimental: may change without notice.
462///
463/// Parameters:
464/// - `state`: string
465pub const SET_WEB_LIFECYCLE_STATE: &str = "Page.setWebLifecycleState";
466
467/// Stops sending each frame in the `screencastFrame`.
468///
469/// Experimental: may change without notice.
470pub const STOP_SCREENCAST: &str = "Page.stopScreencast";
471
472/// Requests backend to produce compilation cache for the specified scripts.
473/// `scripts` are appended to the list of scripts for which the cache would be
474/// produced. The list may be reset during page navigation. When script with a
475/// matching URL is encountered, the cache is optionally produced upon backend
476/// discretion, based on internal heuristics. See also:
477/// `Page.compilationCacheProduced`.
478///
479/// Experimental: may change without notice.
480///
481/// Parameters:
482/// - `scripts`: array
483pub const PRODUCE_COMPILATION_CACHE: &str = "Page.produceCompilationCache";
484
485/// Seeds compilation cache for given url. Compilation cache does not survive
486/// cross-process navigation.
487///
488/// Experimental: may change without notice.
489///
490/// Parameters:
491/// - `url`: string
492/// - `data`: string
493pub const ADD_COMPILATION_CACHE: &str = "Page.addCompilationCache";
494
495/// Clears seeded compilation cache.
496///
497/// Experimental: may change without notice.
498pub const CLEAR_COMPILATION_CACHE: &str = "Page.clearCompilationCache";
499
500/// Sets the Secure Payment Confirmation transaction mode.
501/// <https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode>
502///
503/// Experimental: may change without notice.
504///
505/// Parameters:
506/// - `mode`: string
507pub const SET_SPC_TRANSACTION_MODE: &str = "Page.setSPCTransactionMode";
508
509/// Extensions for Custom Handlers API:
510/// <https://html.spec.whatwg.org/multipage/system-state.html#rph-automation>
511///
512/// Experimental: may change without notice.
513///
514/// Parameters:
515/// - `mode`: string
516pub const SET_RPH_REGISTRATION_MODE: &str = "Page.setRPHRegistrationMode";
517
518/// Generates a report for testing.
519///
520/// Experimental: may change without notice.
521///
522/// Parameters:
523/// - `message`: string
524/// - `group`: string (optional)
525pub const GENERATE_TEST_REPORT: &str = "Page.generateTestReport";
526
527/// Pauses page execution. Can be resumed using generic
528/// Runtime.runIfWaitingForDebugger.
529///
530/// Experimental: may change without notice.
531pub const WAIT_FOR_DEBUGGER: &str = "Page.waitForDebugger";
532
533/// Intercept file chooser requests and transfer control to protocol clients.
534/// When file chooser interception is enabled, native file chooser dialog is
535/// not shown. Instead, a protocol event `Page.fileChooserOpened` is emitted.
536///
537/// Parameters:
538/// - `enabled`: boolean
539/// - `cancel`: boolean (optional)
540pub const SET_INTERCEPT_FILE_CHOOSER_DIALOG: &str = "Page.setInterceptFileChooserDialog";
541
542/// Enable/disable prerendering manually. This command is a short-term
543/// solution for <https://crbug.com/1440085>. See
544/// <https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA>
545/// for more details. TODO(<https://crbug.com/1440085>): Remove this once
546/// Puppeteer supports tab targets.
547///
548/// Experimental: may change without notice.
549///
550/// Parameters:
551/// - `isAllowed`: boolean
552pub const SET_PRERENDERING_ALLOWED: &str = "Page.setPrerenderingAllowed";
553
554/// Get the annotated page content for the main frame. This is an experimental
555/// command that is subject to change.
556///
557/// Experimental: may change without notice.
558///
559/// Parameters:
560/// - `includeActionableInformation`: boolean (optional)
561///
562/// Returns: `content`
563pub const GET_ANNOTATED_PAGE_CONTENT: &str = "Page.getAnnotatedPageContent";