Skip to main content

rustenium_cdp_definitions/browser_protocol/page/
commands.rs

1use serde::{Deserialize, Serialize};
2#[doc = "Evaluates given script in every frame upon creation (before loading frame's scripts).\n[addScriptToEvaluateOnNewDocument](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-addScriptToEvaluateOnNewDocument)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct AddScriptToEvaluateOnNewDocumentParams {
5    #[serde(rename = "source")]
6    pub source: String,
7    #[doc = "If specified, creates an isolated world with the given name and evaluates given script in it.\nThis world name will be used as the ExecutionContextDescription::name when the corresponding\nevent is emitted."]
8    #[serde(rename = "worldName")]
9    #[serde(skip_serializing_if = "Option::is_none")]
10    #[serde(default)]
11    pub world_name: Option<String>,
12    #[doc = "Specifies whether command line API should be available to the script, defaults\nto false."]
13    #[serde(rename = "includeCommandLineAPI")]
14    #[serde(skip_serializing_if = "Option::is_none")]
15    #[serde(default)]
16    pub include_command_line_api: Option<bool>,
17    #[doc = "If true, runs the script immediately on existing execution contexts or worlds.\nDefault: false."]
18    #[serde(rename = "runImmediately")]
19    #[serde(skip_serializing_if = "Option::is_none")]
20    #[serde(default)]
21    pub run_immediately: Option<bool>,
22}
23impl AddScriptToEvaluateOnNewDocumentParams {
24    pub fn new(source: impl Into<String>) -> Self {
25        Self {
26            source: source.into(),
27            world_name: None,
28            include_command_line_api: None,
29            run_immediately: None,
30        }
31    }
32}
33impl<T: Into<String>> From<T> for AddScriptToEvaluateOnNewDocumentParams {
34    fn from(url: T) -> Self {
35        AddScriptToEvaluateOnNewDocumentParams::new(url)
36    }
37}
38#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
39pub enum AddScriptToEvaluateOnNewDocumentMethod {
40    #[serde(rename = "Page.addScriptToEvaluateOnNewDocument")]
41    AddScriptToEvaluateOnNewDocument,
42}
43#[doc = "Evaluates given script in every frame upon creation (before loading frame's scripts).\n[addScriptToEvaluateOnNewDocument](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-addScriptToEvaluateOnNewDocument)"]
44#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
45pub struct AddScriptToEvaluateOnNewDocument {
46    pub method: AddScriptToEvaluateOnNewDocumentMethod,
47    pub params: AddScriptToEvaluateOnNewDocumentParams,
48}
49impl AddScriptToEvaluateOnNewDocument {
50    pub const IDENTIFIER: &'static str = "Page.addScriptToEvaluateOnNewDocument";
51    pub fn identifier(&self) -> &'static str {
52        Self::IDENTIFIER
53    }
54}
55impl crate::CommandResult for AddScriptToEvaluateOnNewDocument {
56    type Result = super::results::AddScriptToEvaluateOnNewDocumentResult;
57}
58#[doc = "Brings page to front (activates tab).\n[bringToFront](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-bringToFront)"]
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
60pub struct BringToFrontParams {}
61#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
62pub enum BringToFrontMethod {
63    #[serde(rename = "Page.bringToFront")]
64    BringToFront,
65}
66#[doc = "Brings page to front (activates tab).\n[bringToFront](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-bringToFront)"]
67#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
68pub struct BringToFront {
69    pub method: BringToFrontMethod,
70    pub params: BringToFrontParams,
71}
72impl BringToFront {
73    pub const IDENTIFIER: &'static str = "Page.bringToFront";
74    pub fn identifier(&self) -> &'static str {
75        Self::IDENTIFIER
76    }
77}
78impl crate::CommandResult for BringToFront {
79    type Result = super::results::BringToFrontResult;
80}
81#[doc = "Capture page screenshot.\n[captureScreenshot](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot)"]
82#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
83pub struct CaptureScreenshotParams {
84    #[doc = "Image compression format (defaults to png)."]
85    #[serde(rename = "format")]
86    #[serde(skip_serializing_if = "Option::is_none")]
87    #[serde(default)]
88    pub format: Option<CaptureScreenshotFormat>,
89    #[doc = "Compression quality from range [0..100] (jpeg only)."]
90    #[serde(rename = "quality")]
91    #[serde(skip_serializing_if = "Option::is_none")]
92    #[serde(default)]
93    pub quality: Option<i64>,
94    #[doc = "Capture the screenshot of a given region only."]
95    #[serde(rename = "clip")]
96    #[serde(skip_serializing_if = "Option::is_none")]
97    #[serde(default)]
98    pub clip: Option<super::types::Viewport>,
99    #[doc = "Capture the screenshot from the surface, rather than the view. Defaults to true."]
100    #[serde(rename = "fromSurface")]
101    #[serde(skip_serializing_if = "Option::is_none")]
102    #[serde(default)]
103    pub from_surface: Option<bool>,
104    #[doc = "Capture the screenshot beyond the viewport. Defaults to false."]
105    #[serde(rename = "captureBeyondViewport")]
106    #[serde(skip_serializing_if = "Option::is_none")]
107    #[serde(default)]
108    pub capture_beyond_viewport: Option<bool>,
109    #[doc = "Optimize image encoding for speed, not for resulting size (defaults to false)"]
110    #[serde(rename = "optimizeForSpeed")]
111    #[serde(skip_serializing_if = "Option::is_none")]
112    #[serde(default)]
113    pub optimize_for_speed: Option<bool>,
114}
115#[doc = "Image compression format (defaults to png)."]
116#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
117pub enum CaptureScreenshotFormat {
118    #[serde(rename = "jpeg")]
119    Jpeg,
120    #[serde(rename = "png")]
121    Png,
122    #[serde(rename = "webp")]
123    Webp,
124}
125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
126pub enum CaptureScreenshotMethod {
127    #[serde(rename = "Page.captureScreenshot")]
128    CaptureScreenshot,
129}
130#[doc = "Capture page screenshot.\n[captureScreenshot](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot)"]
131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
132pub struct CaptureScreenshot {
133    pub method: CaptureScreenshotMethod,
134    pub params: CaptureScreenshotParams,
135}
136impl CaptureScreenshot {
137    pub const IDENTIFIER: &'static str = "Page.captureScreenshot";
138    pub fn identifier(&self) -> &'static str {
139        Self::IDENTIFIER
140    }
141}
142impl crate::CommandResult for CaptureScreenshot {
143    type Result = super::results::CaptureScreenshotResult;
144}
145#[doc = "Returns a snapshot of the page as a string. For MHTML format, the serialization includes\niframes, shadow DOM, external resources, and element-inline styles.\n[captureSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureSnapshot)"]
146#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
147pub struct CaptureSnapshotParams {
148    #[doc = "Format (defaults to mhtml)."]
149    #[serde(rename = "format")]
150    #[serde(skip_serializing_if = "Option::is_none")]
151    #[serde(default)]
152    pub format: Option<CaptureSnapshotFormat>,
153}
154#[doc = "Format (defaults to mhtml)."]
155#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
156pub enum CaptureSnapshotFormat {
157    #[serde(rename = "mhtml")]
158    Mhtml,
159}
160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
161pub enum CaptureSnapshotMethod {
162    #[serde(rename = "Page.captureSnapshot")]
163    CaptureSnapshot,
164}
165#[doc = "Returns a snapshot of the page as a string. For MHTML format, the serialization includes\niframes, shadow DOM, external resources, and element-inline styles.\n[captureSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureSnapshot)"]
166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
167pub struct CaptureSnapshot {
168    pub method: CaptureSnapshotMethod,
169    pub params: CaptureSnapshotParams,
170}
171impl CaptureSnapshot {
172    pub const IDENTIFIER: &'static str = "Page.captureSnapshot";
173    pub fn identifier(&self) -> &'static str {
174        Self::IDENTIFIER
175    }
176}
177impl crate::CommandResult for CaptureSnapshot {
178    type Result = super::results::CaptureSnapshotResult;
179}
180#[doc = "Creates an isolated world for the given frame.\n[createIsolatedWorld](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-createIsolatedWorld)"]
181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
182pub struct CreateIsolatedWorldParams {
183    #[doc = "Id of the frame in which the isolated world should be created."]
184    #[serde(rename = "frameId")]
185    pub frame_id: Box<super::types::FrameId>,
186    #[doc = "An optional name which is reported in the Execution Context."]
187    #[serde(rename = "worldName")]
188    #[serde(skip_serializing_if = "Option::is_none")]
189    #[serde(default)]
190    pub world_name: Option<String>,
191    #[doc = "Whether or not universal access should be granted to the isolated world. This is a powerful\noption, use with caution."]
192    #[serde(rename = "grantUniveralAccess")]
193    #[serde(skip_serializing_if = "Option::is_none")]
194    #[serde(default)]
195    pub grant_univeral_access: Option<bool>,
196}
197impl CreateIsolatedWorldParams {
198    pub fn new(frame_id: impl Into<super::types::FrameId>) -> Self {
199        Self {
200            frame_id: Box::new(frame_id.into()),
201            world_name: None,
202            grant_univeral_access: None,
203        }
204    }
205}
206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
207pub enum CreateIsolatedWorldMethod {
208    #[serde(rename = "Page.createIsolatedWorld")]
209    CreateIsolatedWorld,
210}
211#[doc = "Creates an isolated world for the given frame.\n[createIsolatedWorld](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-createIsolatedWorld)"]
212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
213pub struct CreateIsolatedWorld {
214    pub method: CreateIsolatedWorldMethod,
215    pub params: CreateIsolatedWorldParams,
216}
217impl CreateIsolatedWorld {
218    pub const IDENTIFIER: &'static str = "Page.createIsolatedWorld";
219    pub fn identifier(&self) -> &'static str {
220        Self::IDENTIFIER
221    }
222}
223impl crate::CommandResult for CreateIsolatedWorld {
224    type Result = super::results::CreateIsolatedWorldResult;
225}
226#[doc = "Disables page domain notifications.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-disable)"]
227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
228pub struct DisableParams {}
229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
230pub enum DisableMethod {
231    #[serde(rename = "Page.disable")]
232    Disable,
233}
234#[doc = "Disables page domain notifications.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-disable)"]
235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
236pub struct Disable {
237    pub method: DisableMethod,
238    pub params: DisableParams,
239}
240impl Disable {
241    pub const IDENTIFIER: &'static str = "Page.disable";
242    pub fn identifier(&self) -> &'static str {
243        Self::IDENTIFIER
244    }
245}
246impl crate::CommandResult for Disable {
247    type Result = super::results::DisableResult;
248}
249#[doc = "Enables page domain notifications.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-enable)"]
250#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
251pub struct EnableParams {
252    #[doc = "If true, the `Page.fileChooserOpened` event will be emitted regardless of the state set by\n`Page.setInterceptFileChooserDialog` command (default: false)."]
253    #[serde(rename = "enableFileChooserOpenedEvent")]
254    #[serde(skip_serializing_if = "Option::is_none")]
255    #[serde(default)]
256    pub enable_file_chooser_opened_event: Option<bool>,
257}
258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
259pub enum EnableMethod {
260    #[serde(rename = "Page.enable")]
261    Enable,
262}
263#[doc = "Enables page domain notifications.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-enable)"]
264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
265pub struct Enable {
266    pub method: EnableMethod,
267    pub params: EnableParams,
268}
269impl Enable {
270    pub const IDENTIFIER: &'static str = "Page.enable";
271    pub fn identifier(&self) -> &'static str {
272        Self::IDENTIFIER
273    }
274}
275impl crate::CommandResult for Enable {
276    type Result = super::results::EnableResult;
277}
278#[doc = "Gets the processed manifest for this current document.\nThis API always waits for the manifest to be loaded.\nIf manifestId is provided, and it does not match the manifest of the\ncurrent document, this API errors out.\nIf there is not a loaded page, this API errors out immediately.\n[getAppManifest](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getAppManifest)"]
279#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
280pub struct GetAppManifestParams {
281    #[serde(rename = "manifestId")]
282    #[serde(skip_serializing_if = "Option::is_none")]
283    #[serde(default)]
284    pub manifest_id: Option<String>,
285}
286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
287pub enum GetAppManifestMethod {
288    #[serde(rename = "Page.getAppManifest")]
289    GetAppManifest,
290}
291#[doc = "Gets the processed manifest for this current document.\nThis API always waits for the manifest to be loaded.\nIf manifestId is provided, and it does not match the manifest of the\ncurrent document, this API errors out.\nIf there is not a loaded page, this API errors out immediately.\n[getAppManifest](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getAppManifest)"]
292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
293pub struct GetAppManifest {
294    pub method: GetAppManifestMethod,
295    pub params: GetAppManifestParams,
296}
297impl GetAppManifest {
298    pub const IDENTIFIER: &'static str = "Page.getAppManifest";
299    pub fn identifier(&self) -> &'static str {
300        Self::IDENTIFIER
301    }
302}
303impl crate::CommandResult for GetAppManifest {
304    type Result = super::results::GetAppManifestResult;
305}
306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
307pub struct GetInstallabilityErrorsParams {}
308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
309pub enum GetInstallabilityErrorsMethod {
310    #[serde(rename = "Page.getInstallabilityErrors")]
311    GetInstallabilityErrors,
312}
313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
314pub struct GetInstallabilityErrors {
315    pub method: GetInstallabilityErrorsMethod,
316    pub params: GetInstallabilityErrorsParams,
317}
318impl GetInstallabilityErrors {
319    pub const IDENTIFIER: &'static str = "Page.getInstallabilityErrors";
320    pub fn identifier(&self) -> &'static str {
321        Self::IDENTIFIER
322    }
323}
324impl crate::CommandResult for GetInstallabilityErrors {
325    type Result = super::results::GetInstallabilityErrorsResult;
326}
327#[doc = "Returns the unique (PWA) app id.\nOnly returns values if the feature flag 'WebAppEnableManifestId' is enabled\n[getAppId](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getAppId)"]
328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
329pub struct GetAppIdParams {}
330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
331pub enum GetAppIdMethod {
332    #[serde(rename = "Page.getAppId")]
333    GetAppId,
334}
335#[doc = "Returns the unique (PWA) app id.\nOnly returns values if the feature flag 'WebAppEnableManifestId' is enabled\n[getAppId](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getAppId)"]
336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
337pub struct GetAppId {
338    pub method: GetAppIdMethod,
339    pub params: GetAppIdParams,
340}
341impl GetAppId {
342    pub const IDENTIFIER: &'static str = "Page.getAppId";
343    pub fn identifier(&self) -> &'static str {
344        Self::IDENTIFIER
345    }
346}
347impl crate::CommandResult for GetAppId {
348    type Result = super::results::GetAppIdResult;
349}
350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
351pub struct GetAdScriptAncestryParams {
352    #[serde(rename = "frameId")]
353    pub frame_id: Box<super::types::FrameId>,
354}
355impl GetAdScriptAncestryParams {
356    pub fn new(frame_id: impl Into<super::types::FrameId>) -> Self {
357        Self {
358            frame_id: Box::new(frame_id.into()),
359        }
360    }
361}
362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
363pub enum GetAdScriptAncestryMethod {
364    #[serde(rename = "Page.getAdScriptAncestry")]
365    GetAdScriptAncestry,
366}
367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
368pub struct GetAdScriptAncestry {
369    pub method: GetAdScriptAncestryMethod,
370    pub params: GetAdScriptAncestryParams,
371}
372impl GetAdScriptAncestry {
373    pub const IDENTIFIER: &'static str = "Page.getAdScriptAncestry";
374    pub fn identifier(&self) -> &'static str {
375        Self::IDENTIFIER
376    }
377}
378impl crate::CommandResult for GetAdScriptAncestry {
379    type Result = super::results::GetAdScriptAncestryResult;
380}
381#[doc = "Returns present frame tree structure.\n[getFrameTree](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getFrameTree)"]
382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
383pub struct GetFrameTreeParams {}
384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
385pub enum GetFrameTreeMethod {
386    #[serde(rename = "Page.getFrameTree")]
387    GetFrameTree,
388}
389#[doc = "Returns present frame tree structure.\n[getFrameTree](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getFrameTree)"]
390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
391pub struct GetFrameTree {
392    pub method: GetFrameTreeMethod,
393    pub params: GetFrameTreeParams,
394}
395impl GetFrameTree {
396    pub const IDENTIFIER: &'static str = "Page.getFrameTree";
397    pub fn identifier(&self) -> &'static str {
398        Self::IDENTIFIER
399    }
400}
401impl crate::CommandResult for GetFrameTree {
402    type Result = super::results::GetFrameTreeResult;
403}
404#[doc = "Returns metrics relating to the layouting of the page, such as viewport bounds/scale.\n[getLayoutMetrics](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getLayoutMetrics)"]
405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
406pub struct GetLayoutMetricsParams {}
407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
408pub enum GetLayoutMetricsMethod {
409    #[serde(rename = "Page.getLayoutMetrics")]
410    GetLayoutMetrics,
411}
412#[doc = "Returns metrics relating to the layouting of the page, such as viewport bounds/scale.\n[getLayoutMetrics](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getLayoutMetrics)"]
413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
414pub struct GetLayoutMetrics {
415    pub method: GetLayoutMetricsMethod,
416    pub params: GetLayoutMetricsParams,
417}
418impl GetLayoutMetrics {
419    pub const IDENTIFIER: &'static str = "Page.getLayoutMetrics";
420    pub fn identifier(&self) -> &'static str {
421        Self::IDENTIFIER
422    }
423}
424impl crate::CommandResult for GetLayoutMetrics {
425    type Result = super::results::GetLayoutMetricsResult;
426}
427#[doc = "Returns navigation history for the current page.\n[getNavigationHistory](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getNavigationHistory)"]
428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
429pub struct GetNavigationHistoryParams {}
430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
431pub enum GetNavigationHistoryMethod {
432    #[serde(rename = "Page.getNavigationHistory")]
433    GetNavigationHistory,
434}
435#[doc = "Returns navigation history for the current page.\n[getNavigationHistory](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getNavigationHistory)"]
436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
437pub struct GetNavigationHistory {
438    pub method: GetNavigationHistoryMethod,
439    pub params: GetNavigationHistoryParams,
440}
441impl GetNavigationHistory {
442    pub const IDENTIFIER: &'static str = "Page.getNavigationHistory";
443    pub fn identifier(&self) -> &'static str {
444        Self::IDENTIFIER
445    }
446}
447impl crate::CommandResult for GetNavigationHistory {
448    type Result = super::results::GetNavigationHistoryResult;
449}
450#[doc = "Resets navigation history for the current page.\n[resetNavigationHistory](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-resetNavigationHistory)"]
451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
452pub struct ResetNavigationHistoryParams {}
453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
454pub enum ResetNavigationHistoryMethod {
455    #[serde(rename = "Page.resetNavigationHistory")]
456    ResetNavigationHistory,
457}
458#[doc = "Resets navigation history for the current page.\n[resetNavigationHistory](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-resetNavigationHistory)"]
459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
460pub struct ResetNavigationHistory {
461    pub method: ResetNavigationHistoryMethod,
462    pub params: ResetNavigationHistoryParams,
463}
464impl ResetNavigationHistory {
465    pub const IDENTIFIER: &'static str = "Page.resetNavigationHistory";
466    pub fn identifier(&self) -> &'static str {
467        Self::IDENTIFIER
468    }
469}
470impl crate::CommandResult for ResetNavigationHistory {
471    type Result = super::results::ResetNavigationHistoryResult;
472}
473#[doc = "Returns content of the given resource.\n[getResourceContent](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getResourceContent)"]
474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
475pub struct GetResourceContentParams {
476    #[doc = "Frame id to get resource for."]
477    #[serde(rename = "frameId")]
478    pub frame_id: Box<super::types::FrameId>,
479    #[doc = "URL of the resource to get content for."]
480    #[serde(rename = "url")]
481    pub url: String,
482}
483impl GetResourceContentParams {
484    pub fn new(frame_id: impl Into<super::types::FrameId>, url: impl Into<String>) -> Self {
485        Self {
486            frame_id: Box::new(frame_id.into()),
487            url: url.into(),
488        }
489    }
490}
491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
492pub enum GetResourceContentMethod {
493    #[serde(rename = "Page.getResourceContent")]
494    GetResourceContent,
495}
496#[doc = "Returns content of the given resource.\n[getResourceContent](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getResourceContent)"]
497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
498pub struct GetResourceContent {
499    pub method: GetResourceContentMethod,
500    pub params: GetResourceContentParams,
501}
502impl GetResourceContent {
503    pub const IDENTIFIER: &'static str = "Page.getResourceContent";
504    pub fn identifier(&self) -> &'static str {
505        Self::IDENTIFIER
506    }
507}
508impl crate::CommandResult for GetResourceContent {
509    type Result = super::results::GetResourceContentResult;
510}
511#[doc = "Returns present frame / resource tree structure.\n[getResourceTree](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getResourceTree)"]
512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
513pub struct GetResourceTreeParams {}
514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
515pub enum GetResourceTreeMethod {
516    #[serde(rename = "Page.getResourceTree")]
517    GetResourceTree,
518}
519#[doc = "Returns present frame / resource tree structure.\n[getResourceTree](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getResourceTree)"]
520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
521pub struct GetResourceTree {
522    pub method: GetResourceTreeMethod,
523    pub params: GetResourceTreeParams,
524}
525impl GetResourceTree {
526    pub const IDENTIFIER: &'static str = "Page.getResourceTree";
527    pub fn identifier(&self) -> &'static str {
528        Self::IDENTIFIER
529    }
530}
531impl crate::CommandResult for GetResourceTree {
532    type Result = super::results::GetResourceTreeResult;
533}
534#[doc = "Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).\n[handleJavaScriptDialog](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-handleJavaScriptDialog)"]
535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
536pub struct HandleJavaScriptDialogParams {
537    #[doc = "Whether to accept or dismiss the dialog."]
538    #[serde(rename = "accept")]
539    pub accept: bool,
540    #[doc = "The text to enter into the dialog prompt before accepting. Used only if this is a prompt\ndialog."]
541    #[serde(rename = "promptText")]
542    #[serde(skip_serializing_if = "Option::is_none")]
543    #[serde(default)]
544    pub prompt_text: Option<String>,
545}
546impl HandleJavaScriptDialogParams {
547    pub fn new(accept: impl Into<bool>) -> Self {
548        Self {
549            accept: accept.into(),
550            prompt_text: None,
551        }
552    }
553}
554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
555pub enum HandleJavaScriptDialogMethod {
556    #[serde(rename = "Page.handleJavaScriptDialog")]
557    HandleJavaScriptDialog,
558}
559#[doc = "Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).\n[handleJavaScriptDialog](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-handleJavaScriptDialog)"]
560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
561pub struct HandleJavaScriptDialog {
562    pub method: HandleJavaScriptDialogMethod,
563    pub params: HandleJavaScriptDialogParams,
564}
565impl HandleJavaScriptDialog {
566    pub const IDENTIFIER: &'static str = "Page.handleJavaScriptDialog";
567    pub fn identifier(&self) -> &'static str {
568        Self::IDENTIFIER
569    }
570}
571impl crate::CommandResult for HandleJavaScriptDialog {
572    type Result = super::results::HandleJavaScriptDialogResult;
573}
574#[doc = "Navigates current page to the given URL.\n[navigate](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-navigate)"]
575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
576pub struct NavigateParams {
577    #[doc = "URL to navigate the page to."]
578    #[serde(rename = "url")]
579    pub url: String,
580    #[doc = "Referrer URL."]
581    #[serde(rename = "referrer")]
582    #[serde(skip_serializing_if = "Option::is_none")]
583    #[serde(default)]
584    pub referrer: Option<String>,
585    #[doc = "Intended transition type."]
586    #[serde(rename = "transitionType")]
587    #[serde(skip_serializing_if = "Option::is_none")]
588    #[serde(default)]
589    pub transition_type: Option<super::types::TransitionType>,
590    #[doc = "Frame id to navigate, if not specified navigates the top frame."]
591    #[serde(rename = "frameId")]
592    #[serde(skip_serializing_if = "Option::is_none")]
593    #[serde(default)]
594    pub frame_id: Option<Box<super::types::FrameId>>,
595    #[doc = "Referrer-policy used for the navigation."]
596    #[serde(rename = "referrerPolicy")]
597    #[serde(skip_serializing_if = "Option::is_none")]
598    #[serde(default)]
599    pub referrer_policy: Option<super::types::ReferrerPolicy>,
600}
601impl NavigateParams {
602    pub fn new(url: impl Into<String>) -> Self {
603        Self {
604            url: url.into(),
605            referrer: None,
606            transition_type: None,
607            frame_id: None,
608            referrer_policy: None,
609        }
610    }
611}
612impl<T: Into<String>> From<T> for NavigateParams {
613    fn from(url: T) -> Self {
614        NavigateParams::new(url)
615    }
616}
617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
618pub enum NavigateMethod {
619    #[serde(rename = "Page.navigate")]
620    Navigate,
621}
622#[doc = "Navigates current page to the given URL.\n[navigate](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-navigate)"]
623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
624pub struct Navigate {
625    pub method: NavigateMethod,
626    pub params: NavigateParams,
627}
628impl Navigate {
629    pub const IDENTIFIER: &'static str = "Page.navigate";
630    pub fn identifier(&self) -> &'static str {
631        Self::IDENTIFIER
632    }
633}
634impl crate::CommandResult for Navigate {
635    type Result = super::results::NavigateResult;
636}
637#[doc = "Navigates current page to the given history entry.\n[navigateToHistoryEntry](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-navigateToHistoryEntry)"]
638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
639pub struct NavigateToHistoryEntryParams {
640    #[doc = "Unique id of the entry to navigate to."]
641    #[serde(rename = "entryId")]
642    pub entry_id: i64,
643}
644impl NavigateToHistoryEntryParams {
645    pub fn new(entry_id: impl Into<i64>) -> Self {
646        Self {
647            entry_id: entry_id.into(),
648        }
649    }
650}
651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
652pub enum NavigateToHistoryEntryMethod {
653    #[serde(rename = "Page.navigateToHistoryEntry")]
654    NavigateToHistoryEntry,
655}
656#[doc = "Navigates current page to the given history entry.\n[navigateToHistoryEntry](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-navigateToHistoryEntry)"]
657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
658pub struct NavigateToHistoryEntry {
659    pub method: NavigateToHistoryEntryMethod,
660    pub params: NavigateToHistoryEntryParams,
661}
662impl NavigateToHistoryEntry {
663    pub const IDENTIFIER: &'static str = "Page.navigateToHistoryEntry";
664    pub fn identifier(&self) -> &'static str {
665        Self::IDENTIFIER
666    }
667}
668impl crate::CommandResult for NavigateToHistoryEntry {
669    type Result = super::results::NavigateToHistoryEntryResult;
670}
671#[doc = "Print page as PDF.\n[printToPDF](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF)"]
672#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
673pub struct PrintToPdfParams {
674    #[doc = "Paper orientation. Defaults to false."]
675    #[serde(rename = "landscape")]
676    #[serde(skip_serializing_if = "Option::is_none")]
677    #[serde(default)]
678    pub landscape: Option<bool>,
679    #[doc = "Display header and footer. Defaults to false."]
680    #[serde(rename = "displayHeaderFooter")]
681    #[serde(skip_serializing_if = "Option::is_none")]
682    #[serde(default)]
683    pub display_header_footer: Option<bool>,
684    #[doc = "Print background graphics. Defaults to false."]
685    #[serde(rename = "printBackground")]
686    #[serde(skip_serializing_if = "Option::is_none")]
687    #[serde(default)]
688    pub print_background: Option<bool>,
689    #[doc = "Scale of the webpage rendering. Defaults to 1."]
690    #[serde(rename = "scale")]
691    #[serde(skip_serializing_if = "Option::is_none")]
692    #[serde(default)]
693    pub scale: Option<f64>,
694    #[doc = "Paper width in inches. Defaults to 8.5 inches."]
695    #[serde(rename = "paperWidth")]
696    #[serde(skip_serializing_if = "Option::is_none")]
697    #[serde(default)]
698    pub paper_width: Option<f64>,
699    #[doc = "Paper height in inches. Defaults to 11 inches."]
700    #[serde(rename = "paperHeight")]
701    #[serde(skip_serializing_if = "Option::is_none")]
702    #[serde(default)]
703    pub paper_height: Option<f64>,
704    #[doc = "Top margin in inches. Defaults to 1cm (~0.4 inches)."]
705    #[serde(rename = "marginTop")]
706    #[serde(skip_serializing_if = "Option::is_none")]
707    #[serde(default)]
708    pub margin_top: Option<f64>,
709    #[doc = "Bottom margin in inches. Defaults to 1cm (~0.4 inches)."]
710    #[serde(rename = "marginBottom")]
711    #[serde(skip_serializing_if = "Option::is_none")]
712    #[serde(default)]
713    pub margin_bottom: Option<f64>,
714    #[doc = "Left margin in inches. Defaults to 1cm (~0.4 inches)."]
715    #[serde(rename = "marginLeft")]
716    #[serde(skip_serializing_if = "Option::is_none")]
717    #[serde(default)]
718    pub margin_left: Option<f64>,
719    #[doc = "Right margin in inches. Defaults to 1cm (~0.4 inches)."]
720    #[serde(rename = "marginRight")]
721    #[serde(skip_serializing_if = "Option::is_none")]
722    #[serde(default)]
723    pub margin_right: Option<f64>,
724    #[doc = "Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are\nprinted in the document order, not in the order specified, and no\nmore than once.\nDefaults to empty string, which implies the entire document is printed.\nThe page numbers are quietly capped to actual page count of the\ndocument, and ranges beyond the end of the document are ignored.\nIf this results in no pages to print, an error is reported.\nIt is an error to specify a range with start greater than end."]
725    #[serde(rename = "pageRanges")]
726    #[serde(skip_serializing_if = "Option::is_none")]
727    #[serde(default)]
728    pub page_ranges: Option<String>,
729    #[doc = "HTML template for the print header. Should be valid HTML markup with following\nclasses used to inject printing values into them:\n- `date`: formatted print date\n- `title`: document title\n- `url`: document location\n- `pageNumber`: current page number\n- `totalPages`: total pages in the document\n\nFor example, `<span class=title></span>` would generate span containing the title."]
730    #[serde(rename = "headerTemplate")]
731    #[serde(skip_serializing_if = "Option::is_none")]
732    #[serde(default)]
733    pub header_template: Option<String>,
734    #[doc = "HTML template for the print footer. Should use the same format as the `headerTemplate`."]
735    #[serde(rename = "footerTemplate")]
736    #[serde(skip_serializing_if = "Option::is_none")]
737    #[serde(default)]
738    pub footer_template: Option<String>,
739    #[doc = "Whether or not to prefer page size as defined by css. Defaults to false,\nin which case the content will be scaled to fit the paper size."]
740    #[serde(rename = "preferCSSPageSize")]
741    #[serde(skip_serializing_if = "Option::is_none")]
742    #[serde(default)]
743    pub prefer_css_page_size: Option<bool>,
744    #[doc = "return as stream"]
745    #[serde(rename = "transferMode")]
746    #[serde(skip_serializing_if = "Option::is_none")]
747    #[serde(default)]
748    pub transfer_mode: Option<PrintToPdfTransferMode>,
749    #[doc = "Whether or not to generate tagged (accessible) PDF. Defaults to embedder choice."]
750    #[serde(rename = "generateTaggedPDF")]
751    #[serde(skip_serializing_if = "Option::is_none")]
752    #[serde(default)]
753    pub generate_tagged_pdf: Option<bool>,
754    #[doc = "Whether or not to embed the document outline into the PDF."]
755    #[serde(rename = "generateDocumentOutline")]
756    #[serde(skip_serializing_if = "Option::is_none")]
757    #[serde(default)]
758    pub generate_document_outline: Option<bool>,
759}
760#[doc = "return as stream"]
761#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
762pub enum PrintToPdfTransferMode {
763    #[serde(rename = "ReturnAsBase64")]
764    ReturnAsBase64,
765    #[serde(rename = "ReturnAsStream")]
766    ReturnAsStream,
767}
768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
769pub enum PrintToPdfMethod {
770    #[serde(rename = "Page.printToPDF")]
771    PrintToPdf,
772}
773#[doc = "Print page as PDF.\n[printToPDF](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF)"]
774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
775pub struct PrintToPdf {
776    pub method: PrintToPdfMethod,
777    pub params: PrintToPdfParams,
778}
779impl PrintToPdf {
780    pub const IDENTIFIER: &'static str = "Page.printToPDF";
781    pub fn identifier(&self) -> &'static str {
782        Self::IDENTIFIER
783    }
784}
785impl crate::CommandResult for PrintToPdf {
786    type Result = super::results::PrintToPdfResult;
787}
788#[doc = "Reloads given page optionally ignoring the cache.\n[reload](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-reload)"]
789#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
790pub struct ReloadParams {
791    #[doc = "If true, browser cache is ignored (as if the user pressed Shift+refresh)."]
792    #[serde(rename = "ignoreCache")]
793    #[serde(skip_serializing_if = "Option::is_none")]
794    #[serde(default)]
795    pub ignore_cache: Option<bool>,
796    #[doc = "If set, the script will be injected into all frames of the inspected page after reload.\nArgument will be ignored if reloading dataURL origin."]
797    #[serde(rename = "scriptToEvaluateOnLoad")]
798    #[serde(skip_serializing_if = "Option::is_none")]
799    #[serde(default)]
800    pub script_to_evaluate_on_load: Option<String>,
801    #[doc = "If set, an error will be thrown if the target page's main frame's\nloader id does not match the provided id. This prevents accidentally\nreloading an unintended target in case there's a racing navigation."]
802    #[serde(rename = "loaderId")]
803    #[serde(skip_serializing_if = "Option::is_none")]
804    #[serde(default)]
805    pub loader_id: Option<crate::browser_protocol::network::types::LoaderId>,
806}
807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
808pub enum ReloadMethod {
809    #[serde(rename = "Page.reload")]
810    Reload,
811}
812#[doc = "Reloads given page optionally ignoring the cache.\n[reload](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-reload)"]
813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
814pub struct Reload {
815    pub method: ReloadMethod,
816    pub params: ReloadParams,
817}
818impl Reload {
819    pub const IDENTIFIER: &'static str = "Page.reload";
820    pub fn identifier(&self) -> &'static str {
821        Self::IDENTIFIER
822    }
823}
824impl crate::CommandResult for Reload {
825    type Result = super::results::ReloadResult;
826}
827#[doc = "Removes given script from the list.\n[removeScriptToEvaluateOnNewDocument](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-removeScriptToEvaluateOnNewDocument)"]
828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
829pub struct RemoveScriptToEvaluateOnNewDocumentParams {
830    #[serde(rename = "identifier")]
831    pub identifier: super::types::ScriptIdentifier,
832}
833impl RemoveScriptToEvaluateOnNewDocumentParams {
834    pub fn new(identifier: impl Into<super::types::ScriptIdentifier>) -> Self {
835        Self {
836            identifier: identifier.into(),
837        }
838    }
839}
840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
841pub enum RemoveScriptToEvaluateOnNewDocumentMethod {
842    #[serde(rename = "Page.removeScriptToEvaluateOnNewDocument")]
843    RemoveScriptToEvaluateOnNewDocument,
844}
845#[doc = "Removes given script from the list.\n[removeScriptToEvaluateOnNewDocument](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-removeScriptToEvaluateOnNewDocument)"]
846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
847pub struct RemoveScriptToEvaluateOnNewDocument {
848    pub method: RemoveScriptToEvaluateOnNewDocumentMethod,
849    pub params: RemoveScriptToEvaluateOnNewDocumentParams,
850}
851impl RemoveScriptToEvaluateOnNewDocument {
852    pub const IDENTIFIER: &'static str = "Page.removeScriptToEvaluateOnNewDocument";
853    pub fn identifier(&self) -> &'static str {
854        Self::IDENTIFIER
855    }
856}
857impl crate::CommandResult for RemoveScriptToEvaluateOnNewDocument {
858    type Result = super::results::RemoveScriptToEvaluateOnNewDocumentResult;
859}
860#[doc = "Acknowledges that a screencast frame has been received by the frontend.\n[screencastFrameAck](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-screencastFrameAck)"]
861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
862pub struct ScreencastFrameAckParams {
863    #[doc = "Frame number."]
864    #[serde(rename = "sessionId")]
865    pub session_id: i64,
866}
867impl ScreencastFrameAckParams {
868    pub fn new(session_id: impl Into<i64>) -> Self {
869        Self {
870            session_id: session_id.into(),
871        }
872    }
873}
874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
875pub enum ScreencastFrameAckMethod {
876    #[serde(rename = "Page.screencastFrameAck")]
877    ScreencastFrameAck,
878}
879#[doc = "Acknowledges that a screencast frame has been received by the frontend.\n[screencastFrameAck](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-screencastFrameAck)"]
880#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
881pub struct ScreencastFrameAck {
882    pub method: ScreencastFrameAckMethod,
883    pub params: ScreencastFrameAckParams,
884}
885impl ScreencastFrameAck {
886    pub const IDENTIFIER: &'static str = "Page.screencastFrameAck";
887    pub fn identifier(&self) -> &'static str {
888        Self::IDENTIFIER
889    }
890}
891impl crate::CommandResult for ScreencastFrameAck {
892    type Result = super::results::ScreencastFrameAckResult;
893}
894#[doc = "Searches for given string in resource content.\n[searchInResource](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-searchInResource)"]
895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
896pub struct SearchInResourceParams {
897    #[doc = "Frame id for resource to search in."]
898    #[serde(rename = "frameId")]
899    pub frame_id: Box<super::types::FrameId>,
900    #[doc = "URL of the resource to search in."]
901    #[serde(rename = "url")]
902    pub url: String,
903    #[doc = "String to search for."]
904    #[serde(rename = "query")]
905    pub query: String,
906    #[doc = "If true, search is case sensitive."]
907    #[serde(rename = "caseSensitive")]
908    #[serde(skip_serializing_if = "Option::is_none")]
909    #[serde(default)]
910    pub case_sensitive: Option<bool>,
911    #[doc = "If true, treats string parameter as regex."]
912    #[serde(rename = "isRegex")]
913    #[serde(skip_serializing_if = "Option::is_none")]
914    #[serde(default)]
915    pub is_regex: Option<bool>,
916}
917impl SearchInResourceParams {
918    pub fn new(
919        frame_id: impl Into<super::types::FrameId>,
920        url: impl Into<String>,
921        query: impl Into<String>,
922    ) -> Self {
923        Self {
924            frame_id: Box::new(frame_id.into()),
925            url: url.into(),
926            query: query.into(),
927            case_sensitive: None,
928            is_regex: None,
929        }
930    }
931}
932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
933pub enum SearchInResourceMethod {
934    #[serde(rename = "Page.searchInResource")]
935    SearchInResource,
936}
937#[doc = "Searches for given string in resource content.\n[searchInResource](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-searchInResource)"]
938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
939pub struct SearchInResource {
940    pub method: SearchInResourceMethod,
941    pub params: SearchInResourceParams,
942}
943impl SearchInResource {
944    pub const IDENTIFIER: &'static str = "Page.searchInResource";
945    pub fn identifier(&self) -> &'static str {
946        Self::IDENTIFIER
947    }
948}
949impl crate::CommandResult for SearchInResource {
950    type Result = super::results::SearchInResourceResult;
951}
952#[doc = "Enable Chrome's experimental ad filter on all sites.\n[setAdBlockingEnabled](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setAdBlockingEnabled)"]
953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
954pub struct SetAdBlockingEnabledParams {
955    #[doc = "Whether to block ads."]
956    #[serde(rename = "enabled")]
957    pub enabled: bool,
958}
959impl SetAdBlockingEnabledParams {
960    pub fn new(enabled: impl Into<bool>) -> Self {
961        Self {
962            enabled: enabled.into(),
963        }
964    }
965}
966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
967pub enum SetAdBlockingEnabledMethod {
968    #[serde(rename = "Page.setAdBlockingEnabled")]
969    SetAdBlockingEnabled,
970}
971#[doc = "Enable Chrome's experimental ad filter on all sites.\n[setAdBlockingEnabled](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setAdBlockingEnabled)"]
972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
973pub struct SetAdBlockingEnabled {
974    pub method: SetAdBlockingEnabledMethod,
975    pub params: SetAdBlockingEnabledParams,
976}
977impl SetAdBlockingEnabled {
978    pub const IDENTIFIER: &'static str = "Page.setAdBlockingEnabled";
979    pub fn identifier(&self) -> &'static str {
980        Self::IDENTIFIER
981    }
982}
983impl crate::CommandResult for SetAdBlockingEnabled {
984    type Result = super::results::SetAdBlockingEnabledResult;
985}
986#[doc = "Enable page Content Security Policy by-passing.\n[setBypassCSP](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setBypassCSP)"]
987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
988pub struct SetBypassCspParams {
989    #[doc = "Whether to bypass page CSP."]
990    #[serde(rename = "enabled")]
991    pub enabled: bool,
992}
993impl SetBypassCspParams {
994    pub fn new(enabled: impl Into<bool>) -> Self {
995        Self {
996            enabled: enabled.into(),
997        }
998    }
999}
1000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1001pub enum SetBypassCspMethod {
1002    #[serde(rename = "Page.setBypassCSP")]
1003    SetBypassCsp,
1004}
1005#[doc = "Enable page Content Security Policy by-passing.\n[setBypassCSP](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setBypassCSP)"]
1006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1007pub struct SetBypassCsp {
1008    pub method: SetBypassCspMethod,
1009    pub params: SetBypassCspParams,
1010}
1011impl SetBypassCsp {
1012    pub const IDENTIFIER: &'static str = "Page.setBypassCSP";
1013    pub fn identifier(&self) -> &'static str {
1014        Self::IDENTIFIER
1015    }
1016}
1017impl crate::CommandResult for SetBypassCsp {
1018    type Result = super::results::SetBypassCspResult;
1019}
1020#[doc = "Get Permissions Policy state on given frame.\n[getPermissionsPolicyState](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getPermissionsPolicyState)"]
1021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1022pub struct GetPermissionsPolicyStateParams {
1023    #[serde(rename = "frameId")]
1024    pub frame_id: Box<super::types::FrameId>,
1025}
1026impl GetPermissionsPolicyStateParams {
1027    pub fn new(frame_id: impl Into<super::types::FrameId>) -> Self {
1028        Self {
1029            frame_id: Box::new(frame_id.into()),
1030        }
1031    }
1032}
1033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1034pub enum GetPermissionsPolicyStateMethod {
1035    #[serde(rename = "Page.getPermissionsPolicyState")]
1036    GetPermissionsPolicyState,
1037}
1038#[doc = "Get Permissions Policy state on given frame.\n[getPermissionsPolicyState](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getPermissionsPolicyState)"]
1039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1040pub struct GetPermissionsPolicyState {
1041    pub method: GetPermissionsPolicyStateMethod,
1042    pub params: GetPermissionsPolicyStateParams,
1043}
1044impl GetPermissionsPolicyState {
1045    pub const IDENTIFIER: &'static str = "Page.getPermissionsPolicyState";
1046    pub fn identifier(&self) -> &'static str {
1047        Self::IDENTIFIER
1048    }
1049}
1050impl crate::CommandResult for GetPermissionsPolicyState {
1051    type Result = super::results::GetPermissionsPolicyStateResult;
1052}
1053#[doc = "Get Origin Trials on given frame.\n[getOriginTrials](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getOriginTrials)"]
1054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1055pub struct GetOriginTrialsParams {
1056    #[serde(rename = "frameId")]
1057    pub frame_id: Box<super::types::FrameId>,
1058}
1059impl GetOriginTrialsParams {
1060    pub fn new(frame_id: impl Into<super::types::FrameId>) -> Self {
1061        Self {
1062            frame_id: Box::new(frame_id.into()),
1063        }
1064    }
1065}
1066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1067pub enum GetOriginTrialsMethod {
1068    #[serde(rename = "Page.getOriginTrials")]
1069    GetOriginTrials,
1070}
1071#[doc = "Get Origin Trials on given frame.\n[getOriginTrials](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getOriginTrials)"]
1072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1073pub struct GetOriginTrials {
1074    pub method: GetOriginTrialsMethod,
1075    pub params: GetOriginTrialsParams,
1076}
1077impl GetOriginTrials {
1078    pub const IDENTIFIER: &'static str = "Page.getOriginTrials";
1079    pub fn identifier(&self) -> &'static str {
1080        Self::IDENTIFIER
1081    }
1082}
1083impl crate::CommandResult for GetOriginTrials {
1084    type Result = super::results::GetOriginTrialsResult;
1085}
1086#[doc = "Set generic font families.\n[setFontFamilies](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setFontFamilies)"]
1087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1088pub struct SetFontFamiliesParams {
1089    #[doc = "Specifies font families to set. If a font family is not specified, it won't be changed."]
1090    #[serde(rename = "fontFamilies")]
1091    pub font_families: super::types::FontFamilies,
1092    #[doc = "Specifies font families to set for individual scripts."]
1093    #[serde(rename = "forScripts")]
1094    #[serde(skip_serializing_if = "Option::is_none")]
1095    #[serde(default)]
1096    pub for_scripts: Option<Vec<super::types::ScriptFontFamilies>>,
1097}
1098impl SetFontFamiliesParams {
1099    pub fn new(font_families: impl Into<super::types::FontFamilies>) -> Self {
1100        Self {
1101            font_families: font_families.into(),
1102            for_scripts: None,
1103        }
1104    }
1105}
1106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1107pub enum SetFontFamiliesMethod {
1108    #[serde(rename = "Page.setFontFamilies")]
1109    SetFontFamilies,
1110}
1111#[doc = "Set generic font families.\n[setFontFamilies](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setFontFamilies)"]
1112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1113pub struct SetFontFamilies {
1114    pub method: SetFontFamiliesMethod,
1115    pub params: SetFontFamiliesParams,
1116}
1117impl SetFontFamilies {
1118    pub const IDENTIFIER: &'static str = "Page.setFontFamilies";
1119    pub fn identifier(&self) -> &'static str {
1120        Self::IDENTIFIER
1121    }
1122}
1123impl crate::CommandResult for SetFontFamilies {
1124    type Result = super::results::SetFontFamiliesResult;
1125}
1126#[doc = "Set default font sizes.\n[setFontSizes](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setFontSizes)"]
1127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1128pub struct SetFontSizesParams {
1129    #[doc = "Specifies font sizes to set. If a font size is not specified, it won't be changed."]
1130    #[serde(rename = "fontSizes")]
1131    pub font_sizes: super::types::FontSizes,
1132}
1133impl SetFontSizesParams {
1134    pub fn new(font_sizes: impl Into<super::types::FontSizes>) -> Self {
1135        Self {
1136            font_sizes: font_sizes.into(),
1137        }
1138    }
1139}
1140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1141pub enum SetFontSizesMethod {
1142    #[serde(rename = "Page.setFontSizes")]
1143    SetFontSizes,
1144}
1145#[doc = "Set default font sizes.\n[setFontSizes](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setFontSizes)"]
1146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1147pub struct SetFontSizes {
1148    pub method: SetFontSizesMethod,
1149    pub params: SetFontSizesParams,
1150}
1151impl SetFontSizes {
1152    pub const IDENTIFIER: &'static str = "Page.setFontSizes";
1153    pub fn identifier(&self) -> &'static str {
1154        Self::IDENTIFIER
1155    }
1156}
1157impl crate::CommandResult for SetFontSizes {
1158    type Result = super::results::SetFontSizesResult;
1159}
1160#[doc = "Sets given markup as the document's HTML.\n[setDocumentContent](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setDocumentContent)"]
1161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1162pub struct SetDocumentContentParams {
1163    #[doc = "Frame id to set HTML for."]
1164    #[serde(rename = "frameId")]
1165    pub frame_id: Box<super::types::FrameId>,
1166    #[doc = "HTML content to set."]
1167    #[serde(rename = "html")]
1168    pub html: String,
1169}
1170impl SetDocumentContentParams {
1171    pub fn new(frame_id: impl Into<super::types::FrameId>, html: impl Into<String>) -> Self {
1172        Self {
1173            frame_id: Box::new(frame_id.into()),
1174            html: html.into(),
1175        }
1176    }
1177}
1178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1179pub enum SetDocumentContentMethod {
1180    #[serde(rename = "Page.setDocumentContent")]
1181    SetDocumentContent,
1182}
1183#[doc = "Sets given markup as the document's HTML.\n[setDocumentContent](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setDocumentContent)"]
1184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1185pub struct SetDocumentContent {
1186    pub method: SetDocumentContentMethod,
1187    pub params: SetDocumentContentParams,
1188}
1189impl SetDocumentContent {
1190    pub const IDENTIFIER: &'static str = "Page.setDocumentContent";
1191    pub fn identifier(&self) -> &'static str {
1192        Self::IDENTIFIER
1193    }
1194}
1195impl crate::CommandResult for SetDocumentContent {
1196    type Result = super::results::SetDocumentContentResult;
1197}
1198#[doc = "Controls whether page will emit lifecycle events.\n[setLifecycleEventsEnabled](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setLifecycleEventsEnabled)"]
1199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1200pub struct SetLifecycleEventsEnabledParams {
1201    #[doc = "If true, starts emitting lifecycle events."]
1202    #[serde(rename = "enabled")]
1203    pub enabled: bool,
1204}
1205impl SetLifecycleEventsEnabledParams {
1206    pub fn new(enabled: impl Into<bool>) -> Self {
1207        Self {
1208            enabled: enabled.into(),
1209        }
1210    }
1211}
1212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1213pub enum SetLifecycleEventsEnabledMethod {
1214    #[serde(rename = "Page.setLifecycleEventsEnabled")]
1215    SetLifecycleEventsEnabled,
1216}
1217#[doc = "Controls whether page will emit lifecycle events.\n[setLifecycleEventsEnabled](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setLifecycleEventsEnabled)"]
1218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1219pub struct SetLifecycleEventsEnabled {
1220    pub method: SetLifecycleEventsEnabledMethod,
1221    pub params: SetLifecycleEventsEnabledParams,
1222}
1223impl SetLifecycleEventsEnabled {
1224    pub const IDENTIFIER: &'static str = "Page.setLifecycleEventsEnabled";
1225    pub fn identifier(&self) -> &'static str {
1226        Self::IDENTIFIER
1227    }
1228}
1229impl crate::CommandResult for SetLifecycleEventsEnabled {
1230    type Result = super::results::SetLifecycleEventsEnabledResult;
1231}
1232#[doc = "Starts sending each frame using the `screencastFrame` event.\n[startScreencast](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-startScreencast)"]
1233#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
1234pub struct StartScreencastParams {
1235    #[doc = "Image compression format."]
1236    #[serde(rename = "format")]
1237    #[serde(skip_serializing_if = "Option::is_none")]
1238    #[serde(default)]
1239    pub format: Option<StartScreencastFormat>,
1240    #[doc = "Compression quality from range [0..100]."]
1241    #[serde(rename = "quality")]
1242    #[serde(skip_serializing_if = "Option::is_none")]
1243    #[serde(default)]
1244    pub quality: Option<i64>,
1245    #[doc = "Maximum screenshot width."]
1246    #[serde(rename = "maxWidth")]
1247    #[serde(skip_serializing_if = "Option::is_none")]
1248    #[serde(default)]
1249    pub max_width: Option<i64>,
1250    #[doc = "Maximum screenshot height."]
1251    #[serde(rename = "maxHeight")]
1252    #[serde(skip_serializing_if = "Option::is_none")]
1253    #[serde(default)]
1254    pub max_height: Option<i64>,
1255    #[doc = "Send every n-th frame."]
1256    #[serde(rename = "everyNthFrame")]
1257    #[serde(skip_serializing_if = "Option::is_none")]
1258    #[serde(default)]
1259    pub every_nth_frame: Option<i64>,
1260}
1261#[doc = "Image compression format."]
1262#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
1263pub enum StartScreencastFormat {
1264    #[serde(rename = "jpeg")]
1265    Jpeg,
1266    #[serde(rename = "png")]
1267    Png,
1268}
1269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1270pub enum StartScreencastMethod {
1271    #[serde(rename = "Page.startScreencast")]
1272    StartScreencast,
1273}
1274#[doc = "Starts sending each frame using the `screencastFrame` event.\n[startScreencast](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-startScreencast)"]
1275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1276pub struct StartScreencast {
1277    pub method: StartScreencastMethod,
1278    pub params: StartScreencastParams,
1279}
1280impl StartScreencast {
1281    pub const IDENTIFIER: &'static str = "Page.startScreencast";
1282    pub fn identifier(&self) -> &'static str {
1283        Self::IDENTIFIER
1284    }
1285}
1286impl crate::CommandResult for StartScreencast {
1287    type Result = super::results::StartScreencastResult;
1288}
1289#[doc = "Force the page stop all navigations and pending resource fetches.\n[stopLoading](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-stopLoading)"]
1290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1291pub struct StopLoadingParams {}
1292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1293pub enum StopLoadingMethod {
1294    #[serde(rename = "Page.stopLoading")]
1295    StopLoading,
1296}
1297#[doc = "Force the page stop all navigations and pending resource fetches.\n[stopLoading](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-stopLoading)"]
1298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1299pub struct StopLoading {
1300    pub method: StopLoadingMethod,
1301    pub params: StopLoadingParams,
1302}
1303impl StopLoading {
1304    pub const IDENTIFIER: &'static str = "Page.stopLoading";
1305    pub fn identifier(&self) -> &'static str {
1306        Self::IDENTIFIER
1307    }
1308}
1309impl crate::CommandResult for StopLoading {
1310    type Result = super::results::StopLoadingResult;
1311}
1312#[doc = "Crashes renderer on the IO thread, generates minidumps.\n[crash](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-crash)"]
1313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1314pub struct CrashParams {}
1315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1316pub enum CrashMethod {
1317    #[serde(rename = "Page.crash")]
1318    Crash,
1319}
1320#[doc = "Crashes renderer on the IO thread, generates minidumps.\n[crash](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-crash)"]
1321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1322pub struct Crash {
1323    pub method: CrashMethod,
1324    pub params: CrashParams,
1325}
1326impl Crash {
1327    pub const IDENTIFIER: &'static str = "Page.crash";
1328    pub fn identifier(&self) -> &'static str {
1329        Self::IDENTIFIER
1330    }
1331}
1332impl crate::CommandResult for Crash {
1333    type Result = super::results::CrashResult;
1334}
1335#[doc = "Tries to close page, running its beforeunload hooks, if any.\n[close](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-close)"]
1336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1337pub struct CloseParams {}
1338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1339pub enum CloseMethod {
1340    #[serde(rename = "Page.close")]
1341    Close,
1342}
1343#[doc = "Tries to close page, running its beforeunload hooks, if any.\n[close](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-close)"]
1344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1345pub struct Close {
1346    pub method: CloseMethod,
1347    pub params: CloseParams,
1348}
1349impl Close {
1350    pub const IDENTIFIER: &'static str = "Page.close";
1351    pub fn identifier(&self) -> &'static str {
1352        Self::IDENTIFIER
1353    }
1354}
1355impl crate::CommandResult for Close {
1356    type Result = super::results::CloseResult;
1357}
1358#[doc = "Tries to update the web lifecycle state of the page.\nIt will transition the page to the given state according to:\nhttps://github.com/WICG/web-lifecycle/\n[setWebLifecycleState](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setWebLifecycleState)"]
1359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1360pub struct SetWebLifecycleStateParams {
1361    #[doc = "Target lifecycle state"]
1362    #[serde(rename = "state")]
1363    pub state: SetWebLifecycleStateState,
1364}
1365#[doc = "Target lifecycle state"]
1366#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
1367pub enum SetWebLifecycleStateState {
1368    #[serde(rename = "frozen")]
1369    Frozen,
1370    #[serde(rename = "active")]
1371    Active,
1372}
1373impl SetWebLifecycleStateParams {
1374    pub fn new(state: impl Into<SetWebLifecycleStateState>) -> Self {
1375        Self {
1376            state: state.into(),
1377        }
1378    }
1379}
1380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1381pub enum SetWebLifecycleStateMethod {
1382    #[serde(rename = "Page.setWebLifecycleState")]
1383    SetWebLifecycleState,
1384}
1385#[doc = "Tries to update the web lifecycle state of the page.\nIt will transition the page to the given state according to:\nhttps://github.com/WICG/web-lifecycle/\n[setWebLifecycleState](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setWebLifecycleState)"]
1386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1387pub struct SetWebLifecycleState {
1388    pub method: SetWebLifecycleStateMethod,
1389    pub params: SetWebLifecycleStateParams,
1390}
1391impl SetWebLifecycleState {
1392    pub const IDENTIFIER: &'static str = "Page.setWebLifecycleState";
1393    pub fn identifier(&self) -> &'static str {
1394        Self::IDENTIFIER
1395    }
1396}
1397impl crate::CommandResult for SetWebLifecycleState {
1398    type Result = super::results::SetWebLifecycleStateResult;
1399}
1400#[doc = "Stops sending each frame in the `screencastFrame`.\n[stopScreencast](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-stopScreencast)"]
1401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1402pub struct StopScreencastParams {}
1403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1404pub enum StopScreencastMethod {
1405    #[serde(rename = "Page.stopScreencast")]
1406    StopScreencast,
1407}
1408#[doc = "Stops sending each frame in the `screencastFrame`.\n[stopScreencast](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-stopScreencast)"]
1409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1410pub struct StopScreencast {
1411    pub method: StopScreencastMethod,
1412    pub params: StopScreencastParams,
1413}
1414impl StopScreencast {
1415    pub const IDENTIFIER: &'static str = "Page.stopScreencast";
1416    pub fn identifier(&self) -> &'static str {
1417        Self::IDENTIFIER
1418    }
1419}
1420impl crate::CommandResult for StopScreencast {
1421    type Result = super::results::StopScreencastResult;
1422}
1423#[doc = "Requests backend to produce compilation cache for the specified scripts.\n`scripts` are appended to the list of scripts for which the cache\nwould be produced. The list may be reset during page navigation.\nWhen script with a matching URL is encountered, the cache is optionally\nproduced upon backend discretion, based on internal heuristics.\nSee also: `Page.compilationCacheProduced`.\n[produceCompilationCache](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-produceCompilationCache)"]
1424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1425pub struct ProduceCompilationCacheParams {
1426    #[serde(rename = "scripts")]
1427    #[serde(skip_serializing_if = "Vec::is_empty")]
1428    pub scripts: Vec<super::types::CompilationCacheParams>,
1429}
1430impl ProduceCompilationCacheParams {
1431    pub fn new(scripts: Vec<super::types::CompilationCacheParams>) -> Self {
1432        Self { scripts }
1433    }
1434}
1435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1436pub enum ProduceCompilationCacheMethod {
1437    #[serde(rename = "Page.produceCompilationCache")]
1438    ProduceCompilationCache,
1439}
1440#[doc = "Requests backend to produce compilation cache for the specified scripts.\n`scripts` are appended to the list of scripts for which the cache\nwould be produced. The list may be reset during page navigation.\nWhen script with a matching URL is encountered, the cache is optionally\nproduced upon backend discretion, based on internal heuristics.\nSee also: `Page.compilationCacheProduced`.\n[produceCompilationCache](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-produceCompilationCache)"]
1441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1442pub struct ProduceCompilationCache {
1443    pub method: ProduceCompilationCacheMethod,
1444    pub params: ProduceCompilationCacheParams,
1445}
1446impl ProduceCompilationCache {
1447    pub const IDENTIFIER: &'static str = "Page.produceCompilationCache";
1448    pub fn identifier(&self) -> &'static str {
1449        Self::IDENTIFIER
1450    }
1451}
1452impl crate::CommandResult for ProduceCompilationCache {
1453    type Result = super::results::ProduceCompilationCacheResult;
1454}
1455#[doc = "Seeds compilation cache for given url. Compilation cache does not survive\ncross-process navigation.\n[addCompilationCache](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-addCompilationCache)"]
1456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1457pub struct AddCompilationCacheParams {
1458    #[serde(rename = "url")]
1459    pub url: String,
1460    #[doc = "Base64-encoded data"]
1461    #[serde(rename = "data")]
1462    pub data: crate::Binary,
1463}
1464impl AddCompilationCacheParams {
1465    pub fn new(url: impl Into<String>, data: impl Into<crate::Binary>) -> Self {
1466        Self {
1467            url: url.into(),
1468            data: data.into(),
1469        }
1470    }
1471}
1472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1473pub enum AddCompilationCacheMethod {
1474    #[serde(rename = "Page.addCompilationCache")]
1475    AddCompilationCache,
1476}
1477#[doc = "Seeds compilation cache for given url. Compilation cache does not survive\ncross-process navigation.\n[addCompilationCache](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-addCompilationCache)"]
1478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1479pub struct AddCompilationCache {
1480    pub method: AddCompilationCacheMethod,
1481    pub params: AddCompilationCacheParams,
1482}
1483impl AddCompilationCache {
1484    pub const IDENTIFIER: &'static str = "Page.addCompilationCache";
1485    pub fn identifier(&self) -> &'static str {
1486        Self::IDENTIFIER
1487    }
1488}
1489impl crate::CommandResult for AddCompilationCache {
1490    type Result = super::results::AddCompilationCacheResult;
1491}
1492#[doc = "Clears seeded compilation cache.\n[clearCompilationCache](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-clearCompilationCache)"]
1493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1494pub struct ClearCompilationCacheParams {}
1495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1496pub enum ClearCompilationCacheMethod {
1497    #[serde(rename = "Page.clearCompilationCache")]
1498    ClearCompilationCache,
1499}
1500#[doc = "Clears seeded compilation cache.\n[clearCompilationCache](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-clearCompilationCache)"]
1501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1502pub struct ClearCompilationCache {
1503    pub method: ClearCompilationCacheMethod,
1504    pub params: ClearCompilationCacheParams,
1505}
1506impl ClearCompilationCache {
1507    pub const IDENTIFIER: &'static str = "Page.clearCompilationCache";
1508    pub fn identifier(&self) -> &'static str {
1509        Self::IDENTIFIER
1510    }
1511}
1512impl crate::CommandResult for ClearCompilationCache {
1513    type Result = super::results::ClearCompilationCacheResult;
1514}
1515#[doc = "Sets the Secure Payment Confirmation transaction mode.\nhttps://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode\n[setSPCTransactionMode](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setSPCTransactionMode)"]
1516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1517pub struct SetSpcTransactionModeParams {
1518    #[serde(rename = "mode")]
1519    pub mode: SetSpcTransactionModeMode,
1520}
1521#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
1522pub enum SetSpcTransactionModeMode {
1523    #[serde(rename = "none")]
1524    None,
1525    #[serde(rename = "autoAccept")]
1526    AutoAccept,
1527    #[serde(rename = "autoChooseToAuthAnotherWay")]
1528    AutoChooseToAuthAnotherWay,
1529    #[serde(rename = "autoReject")]
1530    AutoReject,
1531    #[serde(rename = "autoOptOut")]
1532    AutoOptOut,
1533}
1534impl SetSpcTransactionModeParams {
1535    pub fn new(mode: impl Into<SetSpcTransactionModeMode>) -> Self {
1536        Self { mode: mode.into() }
1537    }
1538}
1539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1540pub enum SetSpcTransactionModeMethod {
1541    #[serde(rename = "Page.setSPCTransactionMode")]
1542    SetSpcTransactionMode,
1543}
1544#[doc = "Sets the Secure Payment Confirmation transaction mode.\nhttps://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode\n[setSPCTransactionMode](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setSPCTransactionMode)"]
1545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1546pub struct SetSpcTransactionMode {
1547    pub method: SetSpcTransactionModeMethod,
1548    pub params: SetSpcTransactionModeParams,
1549}
1550impl SetSpcTransactionMode {
1551    pub const IDENTIFIER: &'static str = "Page.setSPCTransactionMode";
1552    pub fn identifier(&self) -> &'static str {
1553        Self::IDENTIFIER
1554    }
1555}
1556impl crate::CommandResult for SetSpcTransactionMode {
1557    type Result = super::results::SetSpcTransactionModeResult;
1558}
1559#[doc = "Extensions for Custom Handlers API:\nhttps://html.spec.whatwg.org/multipage/system-state.html#rph-automation\n[setRPHRegistrationMode](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setRPHRegistrationMode)"]
1560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1561pub struct SetRphRegistrationModeParams {
1562    #[serde(rename = "mode")]
1563    pub mode: SetRphRegistrationModeMode,
1564}
1565#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
1566pub enum SetRphRegistrationModeMode {
1567    #[serde(rename = "none")]
1568    None,
1569    #[serde(rename = "autoAccept")]
1570    AutoAccept,
1571    #[serde(rename = "autoReject")]
1572    AutoReject,
1573}
1574impl SetRphRegistrationModeParams {
1575    pub fn new(mode: impl Into<SetRphRegistrationModeMode>) -> Self {
1576        Self { mode: mode.into() }
1577    }
1578}
1579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1580pub enum SetRphRegistrationModeMethod {
1581    #[serde(rename = "Page.setRPHRegistrationMode")]
1582    SetRphRegistrationMode,
1583}
1584#[doc = "Extensions for Custom Handlers API:\nhttps://html.spec.whatwg.org/multipage/system-state.html#rph-automation\n[setRPHRegistrationMode](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setRPHRegistrationMode)"]
1585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1586pub struct SetRphRegistrationMode {
1587    pub method: SetRphRegistrationModeMethod,
1588    pub params: SetRphRegistrationModeParams,
1589}
1590impl SetRphRegistrationMode {
1591    pub const IDENTIFIER: &'static str = "Page.setRPHRegistrationMode";
1592    pub fn identifier(&self) -> &'static str {
1593        Self::IDENTIFIER
1594    }
1595}
1596impl crate::CommandResult for SetRphRegistrationMode {
1597    type Result = super::results::SetRphRegistrationModeResult;
1598}
1599#[doc = "Generates a report for testing.\n[generateTestReport](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-generateTestReport)"]
1600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1601pub struct GenerateTestReportParams {
1602    #[doc = "Message to be displayed in the report."]
1603    #[serde(rename = "message")]
1604    pub message: String,
1605    #[doc = "Specifies the endpoint group to deliver the report to."]
1606    #[serde(rename = "group")]
1607    #[serde(skip_serializing_if = "Option::is_none")]
1608    #[serde(default)]
1609    pub group: Option<String>,
1610}
1611impl GenerateTestReportParams {
1612    pub fn new(message: impl Into<String>) -> Self {
1613        Self {
1614            message: message.into(),
1615            group: None,
1616        }
1617    }
1618}
1619impl<T: Into<String>> From<T> for GenerateTestReportParams {
1620    fn from(url: T) -> Self {
1621        GenerateTestReportParams::new(url)
1622    }
1623}
1624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1625pub enum GenerateTestReportMethod {
1626    #[serde(rename = "Page.generateTestReport")]
1627    GenerateTestReport,
1628}
1629#[doc = "Generates a report for testing.\n[generateTestReport](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-generateTestReport)"]
1630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1631pub struct GenerateTestReport {
1632    pub method: GenerateTestReportMethod,
1633    pub params: GenerateTestReportParams,
1634}
1635impl GenerateTestReport {
1636    pub const IDENTIFIER: &'static str = "Page.generateTestReport";
1637    pub fn identifier(&self) -> &'static str {
1638        Self::IDENTIFIER
1639    }
1640}
1641impl crate::CommandResult for GenerateTestReport {
1642    type Result = super::results::GenerateTestReportResult;
1643}
1644#[doc = "Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.\n[waitForDebugger](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-waitForDebugger)"]
1645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1646pub struct WaitForDebuggerParams {}
1647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1648pub enum WaitForDebuggerMethod {
1649    #[serde(rename = "Page.waitForDebugger")]
1650    WaitForDebugger,
1651}
1652#[doc = "Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.\n[waitForDebugger](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-waitForDebugger)"]
1653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1654pub struct WaitForDebugger {
1655    pub method: WaitForDebuggerMethod,
1656    pub params: WaitForDebuggerParams,
1657}
1658impl WaitForDebugger {
1659    pub const IDENTIFIER: &'static str = "Page.waitForDebugger";
1660    pub fn identifier(&self) -> &'static str {
1661        Self::IDENTIFIER
1662    }
1663}
1664impl crate::CommandResult for WaitForDebugger {
1665    type Result = super::results::WaitForDebuggerResult;
1666}
1667#[doc = "Intercept file chooser requests and transfer control to protocol clients.\nWhen file chooser interception is enabled, native file chooser dialog is not shown.\nInstead, a protocol event `Page.fileChooserOpened` is emitted.\n[setInterceptFileChooserDialog](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setInterceptFileChooserDialog)"]
1668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1669pub struct SetInterceptFileChooserDialogParams {
1670    #[serde(rename = "enabled")]
1671    pub enabled: bool,
1672    #[doc = "If true, cancels the dialog by emitting relevant events (if any)\nin addition to not showing it if the interception is enabled\n(default: false)."]
1673    #[serde(rename = "cancel")]
1674    #[serde(skip_serializing_if = "Option::is_none")]
1675    #[serde(default)]
1676    pub cancel: Option<bool>,
1677}
1678impl SetInterceptFileChooserDialogParams {
1679    pub fn new(enabled: impl Into<bool>) -> Self {
1680        Self {
1681            enabled: enabled.into(),
1682            cancel: None,
1683        }
1684    }
1685}
1686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1687pub enum SetInterceptFileChooserDialogMethod {
1688    #[serde(rename = "Page.setInterceptFileChooserDialog")]
1689    SetInterceptFileChooserDialog,
1690}
1691#[doc = "Intercept file chooser requests and transfer control to protocol clients.\nWhen file chooser interception is enabled, native file chooser dialog is not shown.\nInstead, a protocol event `Page.fileChooserOpened` is emitted.\n[setInterceptFileChooserDialog](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setInterceptFileChooserDialog)"]
1692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1693pub struct SetInterceptFileChooserDialog {
1694    pub method: SetInterceptFileChooserDialogMethod,
1695    pub params: SetInterceptFileChooserDialogParams,
1696}
1697impl SetInterceptFileChooserDialog {
1698    pub const IDENTIFIER: &'static str = "Page.setInterceptFileChooserDialog";
1699    pub fn identifier(&self) -> &'static str {
1700        Self::IDENTIFIER
1701    }
1702}
1703impl crate::CommandResult for SetInterceptFileChooserDialog {
1704    type Result = super::results::SetInterceptFileChooserDialogResult;
1705}
1706#[doc = "Enable/disable prerendering manually.\n\nThis command is a short-term solution for https://crbug.com/1440085.\nSee https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA\nfor more details.\n\nTODO(https://crbug.com/1440085): Remove this once Puppeteer supports tab targets.\n[setPrerenderingAllowed](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setPrerenderingAllowed)"]
1707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1708pub struct SetPrerenderingAllowedParams {
1709    #[serde(rename = "isAllowed")]
1710    pub is_allowed: bool,
1711}
1712impl SetPrerenderingAllowedParams {
1713    pub fn new(is_allowed: impl Into<bool>) -> Self {
1714        Self {
1715            is_allowed: is_allowed.into(),
1716        }
1717    }
1718}
1719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1720pub enum SetPrerenderingAllowedMethod {
1721    #[serde(rename = "Page.setPrerenderingAllowed")]
1722    SetPrerenderingAllowed,
1723}
1724#[doc = "Enable/disable prerendering manually.\n\nThis command is a short-term solution for https://crbug.com/1440085.\nSee https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA\nfor more details.\n\nTODO(https://crbug.com/1440085): Remove this once Puppeteer supports tab targets.\n[setPrerenderingAllowed](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setPrerenderingAllowed)"]
1725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1726pub struct SetPrerenderingAllowed {
1727    pub method: SetPrerenderingAllowedMethod,
1728    pub params: SetPrerenderingAllowedParams,
1729}
1730impl SetPrerenderingAllowed {
1731    pub const IDENTIFIER: &'static str = "Page.setPrerenderingAllowed";
1732    pub fn identifier(&self) -> &'static str {
1733        Self::IDENTIFIER
1734    }
1735}
1736impl crate::CommandResult for SetPrerenderingAllowed {
1737    type Result = super::results::SetPrerenderingAllowedResult;
1738}
1739#[doc = "Get the annotated page content for the main frame.\nThis is an experimental command that is subject to change.\n[getAnnotatedPageContent](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getAnnotatedPageContent)"]
1740#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
1741pub struct GetAnnotatedPageContentParams {
1742    #[doc = "Whether to include actionable information. Defaults to true."]
1743    #[serde(rename = "includeActionableInformation")]
1744    #[serde(skip_serializing_if = "Option::is_none")]
1745    #[serde(default)]
1746    pub include_actionable_information: Option<bool>,
1747}
1748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1749pub enum GetAnnotatedPageContentMethod {
1750    #[serde(rename = "Page.getAnnotatedPageContent")]
1751    GetAnnotatedPageContent,
1752}
1753#[doc = "Get the annotated page content for the main frame.\nThis is an experimental command that is subject to change.\n[getAnnotatedPageContent](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-getAnnotatedPageContent)"]
1754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1755pub struct GetAnnotatedPageContent {
1756    pub method: GetAnnotatedPageContentMethod,
1757    pub params: GetAnnotatedPageContentParams,
1758}
1759impl GetAnnotatedPageContent {
1760    pub const IDENTIFIER: &'static str = "Page.getAnnotatedPageContent";
1761    pub fn identifier(&self) -> &'static str {
1762        Self::IDENTIFIER
1763    }
1764}
1765impl crate::CommandResult for GetAnnotatedPageContent {
1766    type Result = super::results::GetAnnotatedPageContentResult;
1767}
1768group_enum ! (PageCommands { AddScriptToEvaluateOnNewDocument (AddScriptToEvaluateOnNewDocument) , BringToFront (BringToFront) , CaptureScreenshot (CaptureScreenshot) , CaptureSnapshot (CaptureSnapshot) , CreateIsolatedWorld (CreateIsolatedWorld) , Disable (Disable) , Enable (Enable) , GetAppManifest (GetAppManifest) , GetInstallabilityErrors (GetInstallabilityErrors) , GetAppId (GetAppId) , GetAdScriptAncestry (GetAdScriptAncestry) , GetFrameTree (GetFrameTree) , GetLayoutMetrics (GetLayoutMetrics) , GetNavigationHistory (GetNavigationHistory) , ResetNavigationHistory (ResetNavigationHistory) , GetResourceContent (GetResourceContent) , GetResourceTree (GetResourceTree) , HandleJavaScriptDialog (HandleJavaScriptDialog) , Navigate (Navigate) , NavigateToHistoryEntry (NavigateToHistoryEntry) , PrintToPdf (PrintToPdf) , Reload (Reload) , RemoveScriptToEvaluateOnNewDocument (RemoveScriptToEvaluateOnNewDocument) , ScreencastFrameAck (ScreencastFrameAck) , SearchInResource (SearchInResource) , SetAdBlockingEnabled (SetAdBlockingEnabled) , SetBypassCsp (SetBypassCsp) , GetPermissionsPolicyState (GetPermissionsPolicyState) , GetOriginTrials (GetOriginTrials) , SetFontFamilies (SetFontFamilies) , SetFontSizes (SetFontSizes) , SetDocumentContent (SetDocumentContent) , SetLifecycleEventsEnabled (SetLifecycleEventsEnabled) , StartScreencast (StartScreencast) , StopLoading (StopLoading) , Crash (Crash) , Close (Close) , SetWebLifecycleState (SetWebLifecycleState) , StopScreencast (StopScreencast) , ProduceCompilationCache (ProduceCompilationCache) , AddCompilationCache (AddCompilationCache) , ClearCompilationCache (ClearCompilationCache) , SetSpcTransactionMode (SetSpcTransactionMode) , SetRphRegistrationMode (SetRphRegistrationMode) , GenerateTestReport (GenerateTestReport) , WaitForDebugger (WaitForDebugger) , SetInterceptFileChooserDialog (SetInterceptFileChooserDialog) , SetPrerenderingAllowed (SetPrerenderingAllowed) , GetAnnotatedPageContent (GetAnnotatedPageContent) } + identifiable);