Skip to main content

browser_protocol/dom/
mod.rs

1//! This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object
2//! that has an 'id'. This 'id' can be used to get additional information on the Node, resolve it into
3//! the JavaScript object wrapper, etc. It is important that client receives DOM events only for the
4//! nodes that are known to the client. Backend keeps track of the nodes that were sent to the client
5//! and never sends the same node twice. It is client's responsibility to collect information about
6//! the nodes that were sent to the client. Note that 'iframe' owner elements will return
7//! corresponding document elements as their child nodes.
8
9
10use serde::{Serialize, Deserialize};
11use serde_json::Value as JsonValue;
12use std::borrow::Cow;
13
14/// Unique DOM node identifier.
15
16pub type NodeId = i64;
17
18/// Unique DOM node identifier used to reference a node that may not have been pushed to the
19/// front-end.
20
21pub type BackendNodeId = i64;
22
23/// Unique identifier for a CSS stylesheet.
24
25pub type StyleSheetId<'a> = Cow<'a, str>;
26
27/// Backend node with a friendly name.
28
29#[derive(Debug, Clone, Serialize, Deserialize, Default)]
30#[serde(rename_all = "camelCase")]
31pub struct BackendNode<'a> {
32    /// 'Node''s nodeType.
33    #[serde(rename = "nodeType")]
34    node_type: i64,
35    /// 'Node''s nodeName.
36    #[serde(rename = "nodeName")]
37    node_name: Cow<'a, str>,
38    #[serde(rename = "backendNodeId")]
39    backend_node_id: BackendNodeId,
40}
41
42impl<'a> BackendNode<'a> {
43    /// Creates a builder for this type with the required parameters:
44    /// * `node_type`: `Node`'s nodeType.
45    /// * `node_name`: `Node`'s nodeName.
46    /// * `backend_node_id`: 
47    pub fn builder(node_type: i64, node_name: impl Into<Cow<'a, str>>, backend_node_id: BackendNodeId) -> BackendNodeBuilder<'a> {
48        BackendNodeBuilder {
49            node_type: node_type,
50            node_name: node_name.into(),
51            backend_node_id: backend_node_id,
52        }
53    }
54    /// 'Node''s nodeType.
55    pub fn node_type(&self) -> i64 { self.node_type }
56    /// 'Node''s nodeName.
57    pub fn node_name(&self) -> &str { self.node_name.as_ref() }
58    pub fn backend_node_id(&self) -> &BackendNodeId { &self.backend_node_id }
59}
60
61
62pub struct BackendNodeBuilder<'a> {
63    node_type: i64,
64    node_name: Cow<'a, str>,
65    backend_node_id: BackendNodeId,
66}
67
68impl<'a> BackendNodeBuilder<'a> {
69    pub fn build(self) -> BackendNode<'a> {
70        BackendNode {
71            node_type: self.node_type,
72            node_name: self.node_name,
73            backend_node_id: self.backend_node_id,
74        }
75    }
76}
77
78/// Pseudo element type.
79
80#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
81pub enum PseudoType {
82    #[default]
83    #[serde(rename = "first-line")]
84    FirstLine,
85    #[serde(rename = "first-letter")]
86    FirstLetter,
87    #[serde(rename = "checkmark")]
88    Checkmark,
89    #[serde(rename = "before")]
90    Before,
91    #[serde(rename = "after")]
92    After,
93    #[serde(rename = "expand-icon")]
94    ExpandIcon,
95    #[serde(rename = "picker-icon")]
96    PickerIcon,
97    #[serde(rename = "interest-button")]
98    InterestButton,
99    #[serde(rename = "marker")]
100    Marker,
101    #[serde(rename = "backdrop")]
102    Backdrop,
103    #[serde(rename = "column")]
104    Column,
105    #[serde(rename = "selection")]
106    Selection,
107    #[serde(rename = "search-text")]
108    SearchText,
109    #[serde(rename = "target-text")]
110    TargetText,
111    #[serde(rename = "spelling-error")]
112    SpellingError,
113    #[serde(rename = "grammar-error")]
114    GrammarError,
115    #[serde(rename = "highlight")]
116    Highlight,
117    #[serde(rename = "first-line-inherited")]
118    FirstLineInherited,
119    #[serde(rename = "scroll-marker")]
120    ScrollMarker,
121    #[serde(rename = "scroll-marker-group")]
122    ScrollMarkerGroup,
123    #[serde(rename = "scroll-button")]
124    ScrollButton,
125    #[serde(rename = "scrollbar")]
126    Scrollbar,
127    #[serde(rename = "scrollbar-thumb")]
128    ScrollbarThumb,
129    #[serde(rename = "scrollbar-button")]
130    ScrollbarButton,
131    #[serde(rename = "scrollbar-track")]
132    ScrollbarTrack,
133    #[serde(rename = "scrollbar-track-piece")]
134    ScrollbarTrackPiece,
135    #[serde(rename = "scrollbar-corner")]
136    ScrollbarCorner,
137    #[serde(rename = "resizer")]
138    Resizer,
139    #[serde(rename = "input-list-button")]
140    InputListButton,
141    #[serde(rename = "view-transition")]
142    ViewTransition,
143    #[serde(rename = "view-transition-group")]
144    ViewTransitionGroup,
145    #[serde(rename = "view-transition-image-pair")]
146    ViewTransitionImagePair,
147    #[serde(rename = "view-transition-group-children")]
148    ViewTransitionGroupChildren,
149    #[serde(rename = "view-transition-old")]
150    ViewTransitionOld,
151    #[serde(rename = "view-transition-new")]
152    ViewTransitionNew,
153    #[serde(rename = "placeholder")]
154    Placeholder,
155    #[serde(rename = "file-selector-button")]
156    FileSelectorButton,
157    #[serde(rename = "details-content")]
158    DetailsContent,
159    #[serde(rename = "picker")]
160    Picker,
161    #[serde(rename = "permission-icon")]
162    PermissionIcon,
163    #[serde(rename = "overscroll-area-parent")]
164    OverscrollAreaParent,
165}
166
167/// Shadow root type.
168
169#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
170pub enum ShadowRootType {
171    #[default]
172    #[serde(rename = "user-agent")]
173    UserAgent,
174    #[serde(rename = "open")]
175    Open,
176    #[serde(rename = "closed")]
177    Closed,
178}
179
180/// Document compatibility mode.
181
182#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
183pub enum CompatibilityMode {
184    #[default]
185    #[serde(rename = "QuirksMode")]
186    QuirksMode,
187    #[serde(rename = "LimitedQuirksMode")]
188    LimitedQuirksMode,
189    #[serde(rename = "NoQuirksMode")]
190    NoQuirksMode,
191}
192
193/// ContainerSelector physical axes
194
195#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
196pub enum PhysicalAxes {
197    #[default]
198    #[serde(rename = "Horizontal")]
199    Horizontal,
200    #[serde(rename = "Vertical")]
201    Vertical,
202    #[serde(rename = "Both")]
203    Both,
204}
205
206/// ContainerSelector logical axes
207
208#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
209pub enum LogicalAxes {
210    #[default]
211    #[serde(rename = "Inline")]
212    Inline,
213    #[serde(rename = "Block")]
214    Block,
215    #[serde(rename = "Both")]
216    Both,
217}
218
219/// Physical scroll orientation
220
221#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
222pub enum ScrollOrientation {
223    #[default]
224    #[serde(rename = "horizontal")]
225    Horizontal,
226    #[serde(rename = "vertical")]
227    Vertical,
228}
229
230/// DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.
231/// DOMNode is a base node mirror type.
232
233#[derive(Debug, Clone, Serialize, Deserialize, Default)]
234#[serde(rename_all = "camelCase")]
235pub struct Node<'a> {
236    /// Node identifier that is passed into the rest of the DOM messages as the 'nodeId'. Backend
237    /// will only push node with given 'id' once. It is aware of all requested nodes and will only
238    /// fire DOM events for nodes known to the client.
239    #[serde(rename = "nodeId")]
240    node_id: NodeId,
241    /// The id of the parent node if any.
242    #[serde(skip_serializing_if = "Option::is_none", rename = "parentId")]
243    parent_id: Option<NodeId>,
244    /// The BackendNodeId for this node.
245    #[serde(rename = "backendNodeId")]
246    backend_node_id: BackendNodeId,
247    /// 'Node''s nodeType.
248    #[serde(rename = "nodeType")]
249    node_type: i64,
250    /// 'Node''s nodeName.
251    #[serde(rename = "nodeName")]
252    node_name: Cow<'a, str>,
253    /// 'Node''s localName.
254    #[serde(rename = "localName")]
255    local_name: Cow<'a, str>,
256    /// 'Node''s nodeValue.
257    #[serde(rename = "nodeValue")]
258    node_value: Cow<'a, str>,
259    /// Child count for 'Container' nodes.
260    #[serde(skip_serializing_if = "Option::is_none", rename = "childNodeCount")]
261    child_node_count: Option<u64>,
262    /// Child nodes of this node when requested with children.
263    #[serde(skip_serializing_if = "Option::is_none")]
264    children: Option<Vec<Box<Node<'a>>>>,
265    /// Attributes of the 'Element' node in the form of flat array '\[name1, value1, name2, value2\]'.
266    #[serde(skip_serializing_if = "Option::is_none")]
267    attributes: Option<Vec<Cow<'a, str>>>,
268    /// Document URL that 'Document' or 'FrameOwner' node points to.
269    #[serde(skip_serializing_if = "Option::is_none", rename = "documentURL")]
270    document_url: Option<Cow<'a, str>>,
271    /// Base URL that 'Document' or 'FrameOwner' node uses for URL completion.
272    #[serde(skip_serializing_if = "Option::is_none", rename = "baseURL")]
273    base_url: Option<Cow<'a, str>>,
274    /// 'DocumentType''s publicId.
275    #[serde(skip_serializing_if = "Option::is_none", rename = "publicId")]
276    public_id: Option<Cow<'a, str>>,
277    /// 'DocumentType''s systemId.
278    #[serde(skip_serializing_if = "Option::is_none", rename = "systemId")]
279    system_id: Option<Cow<'a, str>>,
280    /// 'DocumentType''s internalSubset.
281    #[serde(skip_serializing_if = "Option::is_none", rename = "internalSubset")]
282    internal_subset: Option<Cow<'a, str>>,
283    /// 'Document''s XML version in case of XML documents.
284    #[serde(skip_serializing_if = "Option::is_none", rename = "xmlVersion")]
285    xml_version: Option<Cow<'a, str>>,
286    /// 'Attr''s name.
287    #[serde(skip_serializing_if = "Option::is_none")]
288    name: Option<Cow<'a, str>>,
289    /// 'Attr''s value.
290    #[serde(skip_serializing_if = "Option::is_none")]
291    value: Option<Cow<'a, str>>,
292    /// Pseudo element type for this node.
293    #[serde(skip_serializing_if = "Option::is_none", rename = "pseudoType")]
294    pseudo_type: Option<PseudoType>,
295    /// Pseudo element identifier for this node. Only present if there is a
296    /// valid pseudoType.
297    #[serde(skip_serializing_if = "Option::is_none", rename = "pseudoIdentifier")]
298    pseudo_identifier: Option<Cow<'a, str>>,
299    /// Shadow root type.
300    #[serde(skip_serializing_if = "Option::is_none", rename = "shadowRootType")]
301    shadow_root_type: Option<ShadowRootType>,
302    /// Frame ID for frame owner elements.
303    #[serde(skip_serializing_if = "Option::is_none", rename = "frameId")]
304    frame_id: Option<crate::page::FrameId<'a>>,
305    /// Content document for frame owner elements.
306    #[serde(skip_serializing_if = "Option::is_none", rename = "contentDocument")]
307    content_document: Option<Box<Node<'a>>>,
308    /// Shadow root list for given element host.
309    #[serde(skip_serializing_if = "Option::is_none", rename = "shadowRoots")]
310    shadow_roots: Option<Vec<Box<Node<'a>>>>,
311    /// Content document fragment for template elements.
312    #[serde(skip_serializing_if = "Option::is_none", rename = "templateContent")]
313    template_content: Option<Box<Node<'a>>>,
314    /// Pseudo elements associated with this node.
315    #[serde(skip_serializing_if = "Option::is_none", rename = "pseudoElements")]
316    pseudo_elements: Option<Vec<Box<Node<'a>>>>,
317    /// Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
318    /// This property used to return the imported document for the HTMLImport links.
319    /// The property is always undefined now.
320    #[serde(skip_serializing_if = "Option::is_none", rename = "importedDocument")]
321    imported_document: Option<Box<Node<'a>>>,
322    /// Distributed nodes for given insertion point.
323    #[serde(skip_serializing_if = "Option::is_none", rename = "distributedNodes")]
324    distributed_nodes: Option<Vec<BackendNode<'a>>>,
325    /// Whether the node is SVG.
326    #[serde(skip_serializing_if = "Option::is_none", rename = "isSVG")]
327    is_svg: Option<bool>,
328    #[serde(skip_serializing_if = "Option::is_none", rename = "compatibilityMode")]
329    compatibility_mode: Option<CompatibilityMode>,
330    #[serde(skip_serializing_if = "Option::is_none", rename = "assignedSlot")]
331    assigned_slot: Option<BackendNode<'a>>,
332    #[serde(skip_serializing_if = "Option::is_none", rename = "isScrollable")]
333    is_scrollable: Option<bool>,
334    #[serde(skip_serializing_if = "Option::is_none", rename = "affectedByStartingStyles")]
335    affected_by_starting_styles: Option<bool>,
336    #[serde(skip_serializing_if = "Option::is_none", rename = "adoptedStyleSheets")]
337    adopted_style_sheets: Option<Vec<StyleSheetId<'a>>>,
338    #[serde(skip_serializing_if = "Option::is_none", rename = "adProvenance")]
339    ad_provenance: Option<crate::network::AdProvenance<'a>>,
340}
341
342impl<'a> Node<'a> {
343    /// Creates a builder for this type with the required parameters:
344    /// * `node_id`: Node identifier that is passed into the rest of the DOM messages as the `nodeId`. Backend will only push node with given `id` once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.
345    /// * `backend_node_id`: The BackendNodeId for this node.
346    /// * `node_type`: `Node`'s nodeType.
347    /// * `node_name`: `Node`'s nodeName.
348    /// * `local_name`: `Node`'s localName.
349    /// * `node_value`: `Node`'s nodeValue.
350    pub fn builder(node_id: NodeId, backend_node_id: BackendNodeId, node_type: i64, node_name: impl Into<Cow<'a, str>>, local_name: impl Into<Cow<'a, str>>, node_value: impl Into<Cow<'a, str>>) -> NodeBuilder<'a> {
351        NodeBuilder {
352            node_id: node_id,
353            parent_id: None,
354            backend_node_id: backend_node_id,
355            node_type: node_type,
356            node_name: node_name.into(),
357            local_name: local_name.into(),
358            node_value: node_value.into(),
359            child_node_count: None,
360            children: None,
361            attributes: None,
362            document_url: None,
363            base_url: None,
364            public_id: None,
365            system_id: None,
366            internal_subset: None,
367            xml_version: None,
368            name: None,
369            value: None,
370            pseudo_type: None,
371            pseudo_identifier: None,
372            shadow_root_type: None,
373            frame_id: None,
374            content_document: None,
375            shadow_roots: None,
376            template_content: None,
377            pseudo_elements: None,
378            imported_document: None,
379            distributed_nodes: None,
380            is_svg: None,
381            compatibility_mode: None,
382            assigned_slot: None,
383            is_scrollable: None,
384            affected_by_starting_styles: None,
385            adopted_style_sheets: None,
386            ad_provenance: None,
387        }
388    }
389    /// Node identifier that is passed into the rest of the DOM messages as the 'nodeId'. Backend
390    /// will only push node with given 'id' once. It is aware of all requested nodes and will only
391    /// fire DOM events for nodes known to the client.
392    pub fn node_id(&self) -> &NodeId { &self.node_id }
393    /// The id of the parent node if any.
394    pub fn parent_id(&self) -> Option<&NodeId> { self.parent_id.as_ref() }
395    /// The BackendNodeId for this node.
396    pub fn backend_node_id(&self) -> &BackendNodeId { &self.backend_node_id }
397    /// 'Node''s nodeType.
398    pub fn node_type(&self) -> i64 { self.node_type }
399    /// 'Node''s nodeName.
400    pub fn node_name(&self) -> &str { self.node_name.as_ref() }
401    /// 'Node''s localName.
402    pub fn local_name(&self) -> &str { self.local_name.as_ref() }
403    /// 'Node''s nodeValue.
404    pub fn node_value(&self) -> &str { self.node_value.as_ref() }
405    /// Child count for 'Container' nodes.
406    pub fn child_node_count(&self) -> Option<u64> { self.child_node_count }
407    /// Child nodes of this node when requested with children.
408    pub fn children(&self) -> Option<&[Box<Node<'a>>]> { self.children.as_deref() }
409    /// Attributes of the 'Element' node in the form of flat array '\[name1, value1, name2, value2\]'.
410    pub fn attributes(&self) -> Option<&[Cow<'a, str>]> { self.attributes.as_deref() }
411    /// Document URL that 'Document' or 'FrameOwner' node points to.
412    pub fn document_url(&self) -> Option<&str> { self.document_url.as_deref() }
413    /// Base URL that 'Document' or 'FrameOwner' node uses for URL completion.
414    pub fn base_url(&self) -> Option<&str> { self.base_url.as_deref() }
415    /// 'DocumentType''s publicId.
416    pub fn public_id(&self) -> Option<&str> { self.public_id.as_deref() }
417    /// 'DocumentType''s systemId.
418    pub fn system_id(&self) -> Option<&str> { self.system_id.as_deref() }
419    /// 'DocumentType''s internalSubset.
420    pub fn internal_subset(&self) -> Option<&str> { self.internal_subset.as_deref() }
421    /// 'Document''s XML version in case of XML documents.
422    pub fn xml_version(&self) -> Option<&str> { self.xml_version.as_deref() }
423    /// 'Attr''s name.
424    pub fn name(&self) -> Option<&str> { self.name.as_deref() }
425    /// 'Attr''s value.
426    pub fn value(&self) -> Option<&str> { self.value.as_deref() }
427    /// Pseudo element type for this node.
428    pub fn pseudo_type(&self) -> Option<&PseudoType> { self.pseudo_type.as_ref() }
429    /// Pseudo element identifier for this node. Only present if there is a
430    /// valid pseudoType.
431    pub fn pseudo_identifier(&self) -> Option<&str> { self.pseudo_identifier.as_deref() }
432    /// Shadow root type.
433    pub fn shadow_root_type(&self) -> Option<&ShadowRootType> { self.shadow_root_type.as_ref() }
434    /// Frame ID for frame owner elements.
435    pub fn frame_id(&self) -> Option<&crate::page::FrameId<'a>> { self.frame_id.as_ref() }
436    /// Content document for frame owner elements.
437    pub fn content_document(&self) -> Option<&Node<'a>> { self.content_document.as_deref() }
438    /// Shadow root list for given element host.
439    pub fn shadow_roots(&self) -> Option<&[Box<Node<'a>>]> { self.shadow_roots.as_deref() }
440    /// Content document fragment for template elements.
441    pub fn template_content(&self) -> Option<&Node<'a>> { self.template_content.as_deref() }
442    /// Pseudo elements associated with this node.
443    pub fn pseudo_elements(&self) -> Option<&[Box<Node<'a>>]> { self.pseudo_elements.as_deref() }
444    /// Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
445    /// This property used to return the imported document for the HTMLImport links.
446    /// The property is always undefined now.
447    pub fn imported_document(&self) -> Option<&Node<'a>> { self.imported_document.as_deref() }
448    /// Distributed nodes for given insertion point.
449    pub fn distributed_nodes(&self) -> Option<&[BackendNode<'a>]> { self.distributed_nodes.as_deref() }
450    /// Whether the node is SVG.
451    pub fn is_svg(&self) -> Option<bool> { self.is_svg }
452    pub fn compatibility_mode(&self) -> Option<&CompatibilityMode> { self.compatibility_mode.as_ref() }
453    pub fn assigned_slot(&self) -> Option<&BackendNode<'a>> { self.assigned_slot.as_ref() }
454    pub fn is_scrollable(&self) -> Option<bool> { self.is_scrollable }
455    pub fn affected_by_starting_styles(&self) -> Option<bool> { self.affected_by_starting_styles }
456    pub fn adopted_style_sheets(&self) -> Option<&[StyleSheetId<'a>]> { self.adopted_style_sheets.as_deref() }
457    pub fn ad_provenance(&self) -> Option<&crate::network::AdProvenance<'a>> { self.ad_provenance.as_ref() }
458}
459
460
461pub struct NodeBuilder<'a> {
462    node_id: NodeId,
463    parent_id: Option<NodeId>,
464    backend_node_id: BackendNodeId,
465    node_type: i64,
466    node_name: Cow<'a, str>,
467    local_name: Cow<'a, str>,
468    node_value: Cow<'a, str>,
469    child_node_count: Option<u64>,
470    children: Option<Vec<Box<Node<'a>>>>,
471    attributes: Option<Vec<Cow<'a, str>>>,
472    document_url: Option<Cow<'a, str>>,
473    base_url: Option<Cow<'a, str>>,
474    public_id: Option<Cow<'a, str>>,
475    system_id: Option<Cow<'a, str>>,
476    internal_subset: Option<Cow<'a, str>>,
477    xml_version: Option<Cow<'a, str>>,
478    name: Option<Cow<'a, str>>,
479    value: Option<Cow<'a, str>>,
480    pseudo_type: Option<PseudoType>,
481    pseudo_identifier: Option<Cow<'a, str>>,
482    shadow_root_type: Option<ShadowRootType>,
483    frame_id: Option<crate::page::FrameId<'a>>,
484    content_document: Option<Box<Node<'a>>>,
485    shadow_roots: Option<Vec<Box<Node<'a>>>>,
486    template_content: Option<Box<Node<'a>>>,
487    pseudo_elements: Option<Vec<Box<Node<'a>>>>,
488    imported_document: Option<Box<Node<'a>>>,
489    distributed_nodes: Option<Vec<BackendNode<'a>>>,
490    is_svg: Option<bool>,
491    compatibility_mode: Option<CompatibilityMode>,
492    assigned_slot: Option<BackendNode<'a>>,
493    is_scrollable: Option<bool>,
494    affected_by_starting_styles: Option<bool>,
495    adopted_style_sheets: Option<Vec<StyleSheetId<'a>>>,
496    ad_provenance: Option<crate::network::AdProvenance<'a>>,
497}
498
499impl<'a> NodeBuilder<'a> {
500    /// The id of the parent node if any.
501    pub fn parent_id(mut self, parent_id: NodeId) -> Self { self.parent_id = Some(parent_id); self }
502    /// Child count for 'Container' nodes.
503    pub fn child_node_count(mut self, child_node_count: u64) -> Self { self.child_node_count = Some(child_node_count); self }
504    /// Child nodes of this node when requested with children.
505    pub fn children(mut self, children: Vec<Box<Node<'a>>>) -> Self { self.children = Some(children); self }
506    /// Attributes of the 'Element' node in the form of flat array '\[name1, value1, name2, value2\]'.
507    pub fn attributes(mut self, attributes: Vec<Cow<'a, str>>) -> Self { self.attributes = Some(attributes); self }
508    /// Document URL that 'Document' or 'FrameOwner' node points to.
509    pub fn document_url(mut self, document_url: impl Into<Cow<'a, str>>) -> Self { self.document_url = Some(document_url.into()); self }
510    /// Base URL that 'Document' or 'FrameOwner' node uses for URL completion.
511    pub fn base_url(mut self, base_url: impl Into<Cow<'a, str>>) -> Self { self.base_url = Some(base_url.into()); self }
512    /// 'DocumentType''s publicId.
513    pub fn public_id(mut self, public_id: impl Into<Cow<'a, str>>) -> Self { self.public_id = Some(public_id.into()); self }
514    /// 'DocumentType''s systemId.
515    pub fn system_id(mut self, system_id: impl Into<Cow<'a, str>>) -> Self { self.system_id = Some(system_id.into()); self }
516    /// 'DocumentType''s internalSubset.
517    pub fn internal_subset(mut self, internal_subset: impl Into<Cow<'a, str>>) -> Self { self.internal_subset = Some(internal_subset.into()); self }
518    /// 'Document''s XML version in case of XML documents.
519    pub fn xml_version(mut self, xml_version: impl Into<Cow<'a, str>>) -> Self { self.xml_version = Some(xml_version.into()); self }
520    /// 'Attr''s name.
521    pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
522    /// 'Attr''s value.
523    pub fn value(mut self, value: impl Into<Cow<'a, str>>) -> Self { self.value = Some(value.into()); self }
524    /// Pseudo element type for this node.
525    pub fn pseudo_type(mut self, pseudo_type: impl Into<PseudoType>) -> Self { self.pseudo_type = Some(pseudo_type.into()); self }
526    /// Pseudo element identifier for this node. Only present if there is a
527    /// valid pseudoType.
528    pub fn pseudo_identifier(mut self, pseudo_identifier: impl Into<Cow<'a, str>>) -> Self { self.pseudo_identifier = Some(pseudo_identifier.into()); self }
529    /// Shadow root type.
530    pub fn shadow_root_type(mut self, shadow_root_type: impl Into<ShadowRootType>) -> Self { self.shadow_root_type = Some(shadow_root_type.into()); self }
531    /// Frame ID for frame owner elements.
532    pub fn frame_id(mut self, frame_id: crate::page::FrameId<'a>) -> Self { self.frame_id = Some(frame_id); self }
533    /// Content document for frame owner elements.
534    pub fn content_document(mut self, content_document: Box<Node<'a>>) -> Self { self.content_document = Some(content_document); self }
535    /// Shadow root list for given element host.
536    pub fn shadow_roots(mut self, shadow_roots: Vec<Box<Node<'a>>>) -> Self { self.shadow_roots = Some(shadow_roots); self }
537    /// Content document fragment for template elements.
538    pub fn template_content(mut self, template_content: Box<Node<'a>>) -> Self { self.template_content = Some(template_content); self }
539    /// Pseudo elements associated with this node.
540    pub fn pseudo_elements(mut self, pseudo_elements: Vec<Box<Node<'a>>>) -> Self { self.pseudo_elements = Some(pseudo_elements); self }
541    /// Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
542    /// This property used to return the imported document for the HTMLImport links.
543    /// The property is always undefined now.
544    pub fn imported_document(mut self, imported_document: Box<Node<'a>>) -> Self { self.imported_document = Some(imported_document); self }
545    /// Distributed nodes for given insertion point.
546    pub fn distributed_nodes(mut self, distributed_nodes: Vec<BackendNode<'a>>) -> Self { self.distributed_nodes = Some(distributed_nodes); self }
547    /// Whether the node is SVG.
548    pub fn is_svg(mut self, is_svg: bool) -> Self { self.is_svg = Some(is_svg); self }
549    pub fn compatibility_mode(mut self, compatibility_mode: impl Into<CompatibilityMode>) -> Self { self.compatibility_mode = Some(compatibility_mode.into()); self }
550    pub fn assigned_slot(mut self, assigned_slot: BackendNode<'a>) -> Self { self.assigned_slot = Some(assigned_slot); self }
551    pub fn is_scrollable(mut self, is_scrollable: bool) -> Self { self.is_scrollable = Some(is_scrollable); self }
552    pub fn affected_by_starting_styles(mut self, affected_by_starting_styles: bool) -> Self { self.affected_by_starting_styles = Some(affected_by_starting_styles); self }
553    pub fn adopted_style_sheets(mut self, adopted_style_sheets: Vec<StyleSheetId<'a>>) -> Self { self.adopted_style_sheets = Some(adopted_style_sheets); self }
554    pub fn ad_provenance(mut self, ad_provenance: crate::network::AdProvenance<'a>) -> Self { self.ad_provenance = Some(ad_provenance); self }
555    pub fn build(self) -> Node<'a> {
556        Node {
557            node_id: self.node_id,
558            parent_id: self.parent_id,
559            backend_node_id: self.backend_node_id,
560            node_type: self.node_type,
561            node_name: self.node_name,
562            local_name: self.local_name,
563            node_value: self.node_value,
564            child_node_count: self.child_node_count,
565            children: self.children,
566            attributes: self.attributes,
567            document_url: self.document_url,
568            base_url: self.base_url,
569            public_id: self.public_id,
570            system_id: self.system_id,
571            internal_subset: self.internal_subset,
572            xml_version: self.xml_version,
573            name: self.name,
574            value: self.value,
575            pseudo_type: self.pseudo_type,
576            pseudo_identifier: self.pseudo_identifier,
577            shadow_root_type: self.shadow_root_type,
578            frame_id: self.frame_id,
579            content_document: self.content_document,
580            shadow_roots: self.shadow_roots,
581            template_content: self.template_content,
582            pseudo_elements: self.pseudo_elements,
583            imported_document: self.imported_document,
584            distributed_nodes: self.distributed_nodes,
585            is_svg: self.is_svg,
586            compatibility_mode: self.compatibility_mode,
587            assigned_slot: self.assigned_slot,
588            is_scrollable: self.is_scrollable,
589            affected_by_starting_styles: self.affected_by_starting_styles,
590            adopted_style_sheets: self.adopted_style_sheets,
591            ad_provenance: self.ad_provenance,
592        }
593    }
594}
595
596/// A structure to hold the top-level node of a detached tree and an array of its retained descendants.
597
598#[derive(Debug, Clone, Serialize, Deserialize, Default)]
599#[serde(rename_all = "camelCase")]
600pub struct DetachedElementInfo<'a> {
601    #[serde(rename = "treeNode")]
602    tree_node: Node<'a>,
603    #[serde(rename = "retainedNodeIds")]
604    retained_node_ids: Vec<NodeId>,
605}
606
607impl<'a> DetachedElementInfo<'a> {
608    /// Creates a builder for this type with the required parameters:
609    /// * `tree_node`: 
610    /// * `retained_node_ids`: 
611    pub fn builder(tree_node: Node<'a>, retained_node_ids: Vec<NodeId>) -> DetachedElementInfoBuilder<'a> {
612        DetachedElementInfoBuilder {
613            tree_node: tree_node,
614            retained_node_ids: retained_node_ids,
615        }
616    }
617    pub fn tree_node(&self) -> &Node<'a> { &self.tree_node }
618    pub fn retained_node_ids(&self) -> &[NodeId] { &self.retained_node_ids }
619}
620
621
622pub struct DetachedElementInfoBuilder<'a> {
623    tree_node: Node<'a>,
624    retained_node_ids: Vec<NodeId>,
625}
626
627impl<'a> DetachedElementInfoBuilder<'a> {
628    pub fn build(self) -> DetachedElementInfo<'a> {
629        DetachedElementInfo {
630            tree_node: self.tree_node,
631            retained_node_ids: self.retained_node_ids,
632        }
633    }
634}
635
636/// A structure holding an RGBA color.
637
638#[derive(Debug, Clone, Serialize, Deserialize, Default)]
639#[serde(rename_all = "camelCase")]
640pub struct RGBA {
641    /// The red component, in the \[0-255\] range.
642    r: i64,
643    /// The green component, in the \[0-255\] range.
644    g: i64,
645    /// The blue component, in the \[0-255\] range.
646    b: i64,
647    /// The alpha component, in the \[0-1\] range (default: 1).
648    #[serde(skip_serializing_if = "Option::is_none")]
649    a: Option<f64>,
650}
651
652impl RGBA {
653    /// Creates a builder for this type with the required parameters:
654    /// * `r`: The red component, in the \[0-255\] range.
655    /// * `g`: The green component, in the \[0-255\] range.
656    /// * `b`: The blue component, in the \[0-255\] range.
657    pub fn builder(r: i64, g: i64, b: i64) -> RGBABuilder {
658        RGBABuilder {
659            r: r,
660            g: g,
661            b: b,
662            a: None,
663        }
664    }
665    /// The red component, in the \[0-255\] range.
666    pub fn r(&self) -> i64 { self.r }
667    /// The green component, in the \[0-255\] range.
668    pub fn g(&self) -> i64 { self.g }
669    /// The blue component, in the \[0-255\] range.
670    pub fn b(&self) -> i64 { self.b }
671    /// The alpha component, in the \[0-1\] range (default: 1).
672    pub fn a(&self) -> Option<f64> { self.a }
673}
674
675
676pub struct RGBABuilder {
677    r: i64,
678    g: i64,
679    b: i64,
680    a: Option<f64>,
681}
682
683impl RGBABuilder {
684    /// The alpha component, in the \[0-1\] range (default: 1).
685    pub fn a(mut self, a: f64) -> Self { self.a = Some(a); self }
686    pub fn build(self) -> RGBA {
687        RGBA {
688            r: self.r,
689            g: self.g,
690            b: self.b,
691            a: self.a,
692        }
693    }
694}
695
696/// An array of quad vertices, x immediately followed by y for each point, points clock-wise.
697
698pub type Quad = Vec<f64>;
699
700/// Box model.
701
702#[derive(Debug, Clone, Serialize, Deserialize, Default)]
703#[serde(rename_all = "camelCase")]
704pub struct BoxModel {
705    /// Content box
706    content: Quad,
707    /// Padding box
708    padding: Quad,
709    /// Border box
710    border: Quad,
711    /// Margin box
712    margin: Quad,
713    /// Node width
714    width: u64,
715    /// Node height
716    height: i64,
717    /// Shape outside coordinates
718    #[serde(skip_serializing_if = "Option::is_none", rename = "shapeOutside")]
719    shape_outside: Option<ShapeOutsideInfo>,
720}
721
722impl BoxModel {
723    /// Creates a builder for this type with the required parameters:
724    /// * `content`: Content box
725    /// * `padding`: Padding box
726    /// * `border`: Border box
727    /// * `margin`: Margin box
728    /// * `width`: Node width
729    /// * `height`: Node height
730    pub fn builder(content: Quad, padding: Quad, border: Quad, margin: Quad, width: u64, height: i64) -> BoxModelBuilder {
731        BoxModelBuilder {
732            content: content,
733            padding: padding,
734            border: border,
735            margin: margin,
736            width: width,
737            height: height,
738            shape_outside: None,
739        }
740    }
741    /// Content box
742    pub fn content(&self) -> &Quad { &self.content }
743    /// Padding box
744    pub fn padding(&self) -> &Quad { &self.padding }
745    /// Border box
746    pub fn border(&self) -> &Quad { &self.border }
747    /// Margin box
748    pub fn margin(&self) -> &Quad { &self.margin }
749    /// Node width
750    pub fn width(&self) -> u64 { self.width }
751    /// Node height
752    pub fn height(&self) -> i64 { self.height }
753    /// Shape outside coordinates
754    pub fn shape_outside(&self) -> Option<&ShapeOutsideInfo> { self.shape_outside.as_ref() }
755}
756
757
758pub struct BoxModelBuilder {
759    content: Quad,
760    padding: Quad,
761    border: Quad,
762    margin: Quad,
763    width: u64,
764    height: i64,
765    shape_outside: Option<ShapeOutsideInfo>,
766}
767
768impl BoxModelBuilder {
769    /// Shape outside coordinates
770    pub fn shape_outside(mut self, shape_outside: ShapeOutsideInfo) -> Self { self.shape_outside = Some(shape_outside); self }
771    pub fn build(self) -> BoxModel {
772        BoxModel {
773            content: self.content,
774            padding: self.padding,
775            border: self.border,
776            margin: self.margin,
777            width: self.width,
778            height: self.height,
779            shape_outside: self.shape_outside,
780        }
781    }
782}
783
784/// CSS Shape Outside details.
785
786#[derive(Debug, Clone, Serialize, Deserialize, Default)]
787#[serde(rename_all = "camelCase")]
788pub struct ShapeOutsideInfo {
789    /// Shape bounds
790    bounds: Quad,
791    /// Shape coordinate details
792    shape: Vec<JsonValue>,
793    /// Margin shape bounds
794    #[serde(rename = "marginShape")]
795    margin_shape: Vec<JsonValue>,
796}
797
798impl ShapeOutsideInfo {
799    /// Creates a builder for this type with the required parameters:
800    /// * `bounds`: Shape bounds
801    /// * `shape`: Shape coordinate details
802    /// * `margin_shape`: Margin shape bounds
803    pub fn builder(bounds: Quad, shape: Vec<JsonValue>, margin_shape: Vec<JsonValue>) -> ShapeOutsideInfoBuilder {
804        ShapeOutsideInfoBuilder {
805            bounds: bounds,
806            shape: shape,
807            margin_shape: margin_shape,
808        }
809    }
810    /// Shape bounds
811    pub fn bounds(&self) -> &Quad { &self.bounds }
812    /// Shape coordinate details
813    pub fn shape(&self) -> &[JsonValue] { &self.shape }
814    /// Margin shape bounds
815    pub fn margin_shape(&self) -> &[JsonValue] { &self.margin_shape }
816}
817
818
819pub struct ShapeOutsideInfoBuilder {
820    bounds: Quad,
821    shape: Vec<JsonValue>,
822    margin_shape: Vec<JsonValue>,
823}
824
825impl ShapeOutsideInfoBuilder {
826    pub fn build(self) -> ShapeOutsideInfo {
827        ShapeOutsideInfo {
828            bounds: self.bounds,
829            shape: self.shape,
830            margin_shape: self.margin_shape,
831        }
832    }
833}
834
835/// Rectangle.
836
837#[derive(Debug, Clone, Serialize, Deserialize, Default)]
838#[serde(rename_all = "camelCase")]
839pub struct Rect {
840    /// X coordinate
841    x: f64,
842    /// Y coordinate
843    y: f64,
844    /// Rectangle width
845    width: f64,
846    /// Rectangle height
847    height: f64,
848}
849
850impl Rect {
851    /// Creates a builder for this type with the required parameters:
852    /// * `x`: X coordinate
853    /// * `y`: Y coordinate
854    /// * `width`: Rectangle width
855    /// * `height`: Rectangle height
856    pub fn builder(x: f64, y: f64, width: f64, height: f64) -> RectBuilder {
857        RectBuilder {
858            x: x,
859            y: y,
860            width: width,
861            height: height,
862        }
863    }
864    /// X coordinate
865    pub fn x(&self) -> f64 { self.x }
866    /// Y coordinate
867    pub fn y(&self) -> f64 { self.y }
868    /// Rectangle width
869    pub fn width(&self) -> f64 { self.width }
870    /// Rectangle height
871    pub fn height(&self) -> f64 { self.height }
872}
873
874
875pub struct RectBuilder {
876    x: f64,
877    y: f64,
878    width: f64,
879    height: f64,
880}
881
882impl RectBuilder {
883    pub fn build(self) -> Rect {
884        Rect {
885            x: self.x,
886            y: self.y,
887            width: self.width,
888            height: self.height,
889        }
890    }
891}
892
893
894#[derive(Debug, Clone, Serialize, Deserialize, Default)]
895#[serde(rename_all = "camelCase")]
896pub struct CSSComputedStyleProperty<'a> {
897    /// Computed style property name.
898    name: Cow<'a, str>,
899    /// Computed style property value.
900    value: Cow<'a, str>,
901}
902
903impl<'a> CSSComputedStyleProperty<'a> {
904    /// Creates a builder for this type with the required parameters:
905    /// * `name`: Computed style property name.
906    /// * `value`: Computed style property value.
907    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> CSSComputedStylePropertyBuilder<'a> {
908        CSSComputedStylePropertyBuilder {
909            name: name.into(),
910            value: value.into(),
911        }
912    }
913    /// Computed style property name.
914    pub fn name(&self) -> &str { self.name.as_ref() }
915    /// Computed style property value.
916    pub fn value(&self) -> &str { self.value.as_ref() }
917}
918
919
920pub struct CSSComputedStylePropertyBuilder<'a> {
921    name: Cow<'a, str>,
922    value: Cow<'a, str>,
923}
924
925impl<'a> CSSComputedStylePropertyBuilder<'a> {
926    pub fn build(self) -> CSSComputedStyleProperty<'a> {
927        CSSComputedStyleProperty {
928            name: self.name,
929            value: self.value,
930        }
931    }
932}
933
934/// Collects class names for the node with given id and all of it's child nodes.
935
936#[derive(Debug, Clone, Serialize, Deserialize, Default)]
937#[serde(rename_all = "camelCase")]
938pub struct CollectClassNamesFromSubtreeParams {
939    /// Id of the node to collect class names.
940    #[serde(rename = "nodeId")]
941    node_id: NodeId,
942}
943
944impl CollectClassNamesFromSubtreeParams {
945    /// Creates a builder for this type with the required parameters:
946    /// * `node_id`: Id of the node to collect class names.
947    pub fn builder(node_id: NodeId) -> CollectClassNamesFromSubtreeParamsBuilder {
948        CollectClassNamesFromSubtreeParamsBuilder {
949            node_id: node_id,
950        }
951    }
952    /// Id of the node to collect class names.
953    pub fn node_id(&self) -> &NodeId { &self.node_id }
954}
955
956
957pub struct CollectClassNamesFromSubtreeParamsBuilder {
958    node_id: NodeId,
959}
960
961impl CollectClassNamesFromSubtreeParamsBuilder {
962    pub fn build(self) -> CollectClassNamesFromSubtreeParams {
963        CollectClassNamesFromSubtreeParams {
964            node_id: self.node_id,
965        }
966    }
967}
968
969/// Collects class names for the node with given id and all of it's child nodes.
970
971#[derive(Debug, Clone, Serialize, Deserialize, Default)]
972#[serde(rename_all = "camelCase")]
973pub struct CollectClassNamesFromSubtreeReturns<'a> {
974    /// Class name list.
975    #[serde(rename = "classNames")]
976    class_names: Vec<Cow<'a, str>>,
977}
978
979impl<'a> CollectClassNamesFromSubtreeReturns<'a> {
980    /// Creates a builder for this type with the required parameters:
981    /// * `class_names`: Class name list.
982    pub fn builder(class_names: Vec<Cow<'a, str>>) -> CollectClassNamesFromSubtreeReturnsBuilder<'a> {
983        CollectClassNamesFromSubtreeReturnsBuilder {
984            class_names: class_names,
985        }
986    }
987    /// Class name list.
988    pub fn class_names(&self) -> &[Cow<'a, str>] { &self.class_names }
989}
990
991
992pub struct CollectClassNamesFromSubtreeReturnsBuilder<'a> {
993    class_names: Vec<Cow<'a, str>>,
994}
995
996impl<'a> CollectClassNamesFromSubtreeReturnsBuilder<'a> {
997    pub fn build(self) -> CollectClassNamesFromSubtreeReturns<'a> {
998        CollectClassNamesFromSubtreeReturns {
999            class_names: self.class_names,
1000        }
1001    }
1002}
1003
1004impl CollectClassNamesFromSubtreeParams { pub const METHOD: &'static str = "DOM.collectClassNamesFromSubtree"; }
1005
1006impl<'a> crate::CdpCommand<'a> for CollectClassNamesFromSubtreeParams {
1007    const METHOD: &'static str = "DOM.collectClassNamesFromSubtree";
1008    type Response = CollectClassNamesFromSubtreeReturns<'a>;
1009}
1010
1011/// Creates a deep copy of the specified node and places it into the target container before the
1012/// given anchor.
1013
1014#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1015#[serde(rename_all = "camelCase")]
1016pub struct CopyToParams {
1017    /// Id of the node to copy.
1018    #[serde(rename = "nodeId")]
1019    node_id: NodeId,
1020    /// Id of the element to drop the copy into.
1021    #[serde(rename = "targetNodeId")]
1022    target_node_id: NodeId,
1023    /// Drop the copy before this node (if absent, the copy becomes the last child of
1024    /// 'targetNodeId').
1025    #[serde(skip_serializing_if = "Option::is_none", rename = "insertBeforeNodeId")]
1026    insert_before_node_id: Option<NodeId>,
1027}
1028
1029impl CopyToParams {
1030    /// Creates a builder for this type with the required parameters:
1031    /// * `node_id`: Id of the node to copy.
1032    /// * `target_node_id`: Id of the element to drop the copy into.
1033    pub fn builder(node_id: NodeId, target_node_id: NodeId) -> CopyToParamsBuilder {
1034        CopyToParamsBuilder {
1035            node_id: node_id,
1036            target_node_id: target_node_id,
1037            insert_before_node_id: None,
1038        }
1039    }
1040    /// Id of the node to copy.
1041    pub fn node_id(&self) -> &NodeId { &self.node_id }
1042    /// Id of the element to drop the copy into.
1043    pub fn target_node_id(&self) -> &NodeId { &self.target_node_id }
1044    /// Drop the copy before this node (if absent, the copy becomes the last child of
1045    /// 'targetNodeId').
1046    pub fn insert_before_node_id(&self) -> Option<&NodeId> { self.insert_before_node_id.as_ref() }
1047}
1048
1049
1050pub struct CopyToParamsBuilder {
1051    node_id: NodeId,
1052    target_node_id: NodeId,
1053    insert_before_node_id: Option<NodeId>,
1054}
1055
1056impl CopyToParamsBuilder {
1057    /// Drop the copy before this node (if absent, the copy becomes the last child of
1058    /// 'targetNodeId').
1059    pub fn insert_before_node_id(mut self, insert_before_node_id: NodeId) -> Self { self.insert_before_node_id = Some(insert_before_node_id); self }
1060    pub fn build(self) -> CopyToParams {
1061        CopyToParams {
1062            node_id: self.node_id,
1063            target_node_id: self.target_node_id,
1064            insert_before_node_id: self.insert_before_node_id,
1065        }
1066    }
1067}
1068
1069/// Creates a deep copy of the specified node and places it into the target container before the
1070/// given anchor.
1071
1072#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1073#[serde(rename_all = "camelCase")]
1074pub struct CopyToReturns {
1075    /// Id of the node clone.
1076    #[serde(rename = "nodeId")]
1077    node_id: NodeId,
1078}
1079
1080impl CopyToReturns {
1081    /// Creates a builder for this type with the required parameters:
1082    /// * `node_id`: Id of the node clone.
1083    pub fn builder(node_id: NodeId) -> CopyToReturnsBuilder {
1084        CopyToReturnsBuilder {
1085            node_id: node_id,
1086        }
1087    }
1088    /// Id of the node clone.
1089    pub fn node_id(&self) -> &NodeId { &self.node_id }
1090}
1091
1092
1093pub struct CopyToReturnsBuilder {
1094    node_id: NodeId,
1095}
1096
1097impl CopyToReturnsBuilder {
1098    pub fn build(self) -> CopyToReturns {
1099        CopyToReturns {
1100            node_id: self.node_id,
1101        }
1102    }
1103}
1104
1105impl CopyToParams { pub const METHOD: &'static str = "DOM.copyTo"; }
1106
1107impl<'a> crate::CdpCommand<'a> for CopyToParams {
1108    const METHOD: &'static str = "DOM.copyTo";
1109    type Response = CopyToReturns;
1110}
1111
1112/// Describes node given its id, does not require domain to be enabled. Does not start tracking any
1113/// objects, can be used for automation.
1114
1115#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1116#[serde(rename_all = "camelCase")]
1117pub struct DescribeNodeParams<'a> {
1118    /// Identifier of the node.
1119    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
1120    node_id: Option<NodeId>,
1121    /// Identifier of the backend node.
1122    #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
1123    backend_node_id: Option<BackendNodeId>,
1124    /// JavaScript object id of the node wrapper.
1125    #[serde(skip_serializing_if = "Option::is_none", rename = "objectId")]
1126    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1127    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1128    /// entire subtree or provide an integer larger than 0.
1129    #[serde(skip_serializing_if = "Option::is_none")]
1130    depth: Option<i64>,
1131    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1132    /// (default is false).
1133    #[serde(skip_serializing_if = "Option::is_none")]
1134    pierce: Option<bool>,
1135}
1136
1137impl<'a> DescribeNodeParams<'a> {
1138    /// Creates a builder for this type.
1139    pub fn builder() -> DescribeNodeParamsBuilder<'a> {
1140        DescribeNodeParamsBuilder {
1141            node_id: None,
1142            backend_node_id: None,
1143            object_id: None,
1144            depth: None,
1145            pierce: None,
1146        }
1147    }
1148    /// Identifier of the node.
1149    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
1150    /// Identifier of the backend node.
1151    pub fn backend_node_id(&self) -> Option<&BackendNodeId> { self.backend_node_id.as_ref() }
1152    /// JavaScript object id of the node wrapper.
1153    pub fn object_id(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.object_id.as_ref() }
1154    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1155    /// entire subtree or provide an integer larger than 0.
1156    pub fn depth(&self) -> Option<i64> { self.depth }
1157    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1158    /// (default is false).
1159    pub fn pierce(&self) -> Option<bool> { self.pierce }
1160}
1161
1162#[derive(Default)]
1163pub struct DescribeNodeParamsBuilder<'a> {
1164    node_id: Option<NodeId>,
1165    backend_node_id: Option<BackendNodeId>,
1166    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1167    depth: Option<i64>,
1168    pierce: Option<bool>,
1169}
1170
1171impl<'a> DescribeNodeParamsBuilder<'a> {
1172    /// Identifier of the node.
1173    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
1174    /// Identifier of the backend node.
1175    pub fn backend_node_id(mut self, backend_node_id: BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
1176    /// JavaScript object id of the node wrapper.
1177    pub fn object_id(mut self, object_id: crate::runtime::RemoteObjectId<'a>) -> Self { self.object_id = Some(object_id); self }
1178    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1179    /// entire subtree or provide an integer larger than 0.
1180    pub fn depth(mut self, depth: i64) -> Self { self.depth = Some(depth); self }
1181    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1182    /// (default is false).
1183    pub fn pierce(mut self, pierce: bool) -> Self { self.pierce = Some(pierce); self }
1184    pub fn build(self) -> DescribeNodeParams<'a> {
1185        DescribeNodeParams {
1186            node_id: self.node_id,
1187            backend_node_id: self.backend_node_id,
1188            object_id: self.object_id,
1189            depth: self.depth,
1190            pierce: self.pierce,
1191        }
1192    }
1193}
1194
1195/// Describes node given its id, does not require domain to be enabled. Does not start tracking any
1196/// objects, can be used for automation.
1197
1198#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1199#[serde(rename_all = "camelCase")]
1200pub struct DescribeNodeReturns<'a> {
1201    /// Node description.
1202    node: Node<'a>,
1203}
1204
1205impl<'a> DescribeNodeReturns<'a> {
1206    /// Creates a builder for this type with the required parameters:
1207    /// * `node`: Node description.
1208    pub fn builder(node: Node<'a>) -> DescribeNodeReturnsBuilder<'a> {
1209        DescribeNodeReturnsBuilder {
1210            node: node,
1211        }
1212    }
1213    /// Node description.
1214    pub fn node(&self) -> &Node<'a> { &self.node }
1215}
1216
1217
1218pub struct DescribeNodeReturnsBuilder<'a> {
1219    node: Node<'a>,
1220}
1221
1222impl<'a> DescribeNodeReturnsBuilder<'a> {
1223    pub fn build(self) -> DescribeNodeReturns<'a> {
1224        DescribeNodeReturns {
1225            node: self.node,
1226        }
1227    }
1228}
1229
1230impl<'a> DescribeNodeParams<'a> { pub const METHOD: &'static str = "DOM.describeNode"; }
1231
1232impl<'a> crate::CdpCommand<'a> for DescribeNodeParams<'a> {
1233    const METHOD: &'static str = "DOM.describeNode";
1234    type Response = DescribeNodeReturns<'a>;
1235}
1236
1237/// Scrolls the specified rect of the given node into view if not already visible.
1238/// Note: exactly one between nodeId, backendNodeId and objectId should be passed
1239/// to identify the node.
1240
1241#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1242#[serde(rename_all = "camelCase")]
1243pub struct ScrollIntoViewIfNeededParams<'a> {
1244    /// Identifier of the node.
1245    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
1246    node_id: Option<NodeId>,
1247    /// Identifier of the backend node.
1248    #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
1249    backend_node_id: Option<BackendNodeId>,
1250    /// JavaScript object id of the node wrapper.
1251    #[serde(skip_serializing_if = "Option::is_none", rename = "objectId")]
1252    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1253    /// The rect to be scrolled into view, relative to the node's border box, in CSS pixels.
1254    /// When omitted, center of the node will be used, similar to Element.scrollIntoView.
1255    #[serde(skip_serializing_if = "Option::is_none")]
1256    rect: Option<Rect>,
1257}
1258
1259impl<'a> ScrollIntoViewIfNeededParams<'a> {
1260    /// Creates a builder for this type.
1261    pub fn builder() -> ScrollIntoViewIfNeededParamsBuilder<'a> {
1262        ScrollIntoViewIfNeededParamsBuilder {
1263            node_id: None,
1264            backend_node_id: None,
1265            object_id: None,
1266            rect: None,
1267        }
1268    }
1269    /// Identifier of the node.
1270    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
1271    /// Identifier of the backend node.
1272    pub fn backend_node_id(&self) -> Option<&BackendNodeId> { self.backend_node_id.as_ref() }
1273    /// JavaScript object id of the node wrapper.
1274    pub fn object_id(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.object_id.as_ref() }
1275    /// The rect to be scrolled into view, relative to the node's border box, in CSS pixels.
1276    /// When omitted, center of the node will be used, similar to Element.scrollIntoView.
1277    pub fn rect(&self) -> Option<&Rect> { self.rect.as_ref() }
1278}
1279
1280#[derive(Default)]
1281pub struct ScrollIntoViewIfNeededParamsBuilder<'a> {
1282    node_id: Option<NodeId>,
1283    backend_node_id: Option<BackendNodeId>,
1284    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1285    rect: Option<Rect>,
1286}
1287
1288impl<'a> ScrollIntoViewIfNeededParamsBuilder<'a> {
1289    /// Identifier of the node.
1290    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
1291    /// Identifier of the backend node.
1292    pub fn backend_node_id(mut self, backend_node_id: BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
1293    /// JavaScript object id of the node wrapper.
1294    pub fn object_id(mut self, object_id: crate::runtime::RemoteObjectId<'a>) -> Self { self.object_id = Some(object_id); self }
1295    /// The rect to be scrolled into view, relative to the node's border box, in CSS pixels.
1296    /// When omitted, center of the node will be used, similar to Element.scrollIntoView.
1297    pub fn rect(mut self, rect: Rect) -> Self { self.rect = Some(rect); self }
1298    pub fn build(self) -> ScrollIntoViewIfNeededParams<'a> {
1299        ScrollIntoViewIfNeededParams {
1300            node_id: self.node_id,
1301            backend_node_id: self.backend_node_id,
1302            object_id: self.object_id,
1303            rect: self.rect,
1304        }
1305    }
1306}
1307
1308impl<'a> ScrollIntoViewIfNeededParams<'a> { pub const METHOD: &'static str = "DOM.scrollIntoViewIfNeeded"; }
1309
1310impl<'a> crate::CdpCommand<'a> for ScrollIntoViewIfNeededParams<'a> {
1311    const METHOD: &'static str = "DOM.scrollIntoViewIfNeeded";
1312    type Response = crate::EmptyReturns;
1313}
1314
1315#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1316pub struct DisableParams {}
1317
1318impl DisableParams { pub const METHOD: &'static str = "DOM.disable"; }
1319
1320impl<'a> crate::CdpCommand<'a> for DisableParams {
1321    const METHOD: &'static str = "DOM.disable";
1322    type Response = crate::EmptyReturns;
1323}
1324
1325/// Discards search results from the session with the given id. 'getSearchResults' should no longer
1326/// be called for that search.
1327
1328#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1329#[serde(rename_all = "camelCase")]
1330pub struct DiscardSearchResultsParams<'a> {
1331    /// Unique search session identifier.
1332    #[serde(rename = "searchId")]
1333    search_id: Cow<'a, str>,
1334}
1335
1336impl<'a> DiscardSearchResultsParams<'a> {
1337    /// Creates a builder for this type with the required parameters:
1338    /// * `search_id`: Unique search session identifier.
1339    pub fn builder(search_id: impl Into<Cow<'a, str>>) -> DiscardSearchResultsParamsBuilder<'a> {
1340        DiscardSearchResultsParamsBuilder {
1341            search_id: search_id.into(),
1342        }
1343    }
1344    /// Unique search session identifier.
1345    pub fn search_id(&self) -> &str { self.search_id.as_ref() }
1346}
1347
1348
1349pub struct DiscardSearchResultsParamsBuilder<'a> {
1350    search_id: Cow<'a, str>,
1351}
1352
1353impl<'a> DiscardSearchResultsParamsBuilder<'a> {
1354    pub fn build(self) -> DiscardSearchResultsParams<'a> {
1355        DiscardSearchResultsParams {
1356            search_id: self.search_id,
1357        }
1358    }
1359}
1360
1361impl<'a> DiscardSearchResultsParams<'a> { pub const METHOD: &'static str = "DOM.discardSearchResults"; }
1362
1363impl<'a> crate::CdpCommand<'a> for DiscardSearchResultsParams<'a> {
1364    const METHOD: &'static str = "DOM.discardSearchResults";
1365    type Response = crate::EmptyReturns;
1366}
1367
1368/// Enables DOM agent for the given page.
1369
1370#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1371#[serde(rename_all = "camelCase")]
1372pub struct EnableParams<'a> {
1373    /// Whether to include whitespaces in the children array of returned Nodes.
1374    #[serde(skip_serializing_if = "Option::is_none", rename = "includeWhitespace")]
1375    include_whitespace: Option<Cow<'a, str>>,
1376}
1377
1378impl<'a> EnableParams<'a> {
1379    /// Creates a builder for this type.
1380    pub fn builder() -> EnableParamsBuilder<'a> {
1381        EnableParamsBuilder {
1382            include_whitespace: None,
1383        }
1384    }
1385    /// Whether to include whitespaces in the children array of returned Nodes.
1386    pub fn include_whitespace(&self) -> Option<&str> { self.include_whitespace.as_deref() }
1387}
1388
1389#[derive(Default)]
1390pub struct EnableParamsBuilder<'a> {
1391    include_whitespace: Option<Cow<'a, str>>,
1392}
1393
1394impl<'a> EnableParamsBuilder<'a> {
1395    /// Whether to include whitespaces in the children array of returned Nodes.
1396    pub fn include_whitespace(mut self, include_whitespace: impl Into<Cow<'a, str>>) -> Self { self.include_whitespace = Some(include_whitespace.into()); self }
1397    pub fn build(self) -> EnableParams<'a> {
1398        EnableParams {
1399            include_whitespace: self.include_whitespace,
1400        }
1401    }
1402}
1403
1404impl<'a> EnableParams<'a> { pub const METHOD: &'static str = "DOM.enable"; }
1405
1406impl<'a> crate::CdpCommand<'a> for EnableParams<'a> {
1407    const METHOD: &'static str = "DOM.enable";
1408    type Response = crate::EmptyReturns;
1409}
1410
1411/// Focuses the given element.
1412
1413#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1414#[serde(rename_all = "camelCase")]
1415pub struct FocusParams<'a> {
1416    /// Identifier of the node.
1417    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
1418    node_id: Option<NodeId>,
1419    /// Identifier of the backend node.
1420    #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
1421    backend_node_id: Option<BackendNodeId>,
1422    /// JavaScript object id of the node wrapper.
1423    #[serde(skip_serializing_if = "Option::is_none", rename = "objectId")]
1424    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1425}
1426
1427impl<'a> FocusParams<'a> {
1428    /// Creates a builder for this type.
1429    pub fn builder() -> FocusParamsBuilder<'a> {
1430        FocusParamsBuilder {
1431            node_id: None,
1432            backend_node_id: None,
1433            object_id: None,
1434        }
1435    }
1436    /// Identifier of the node.
1437    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
1438    /// Identifier of the backend node.
1439    pub fn backend_node_id(&self) -> Option<&BackendNodeId> { self.backend_node_id.as_ref() }
1440    /// JavaScript object id of the node wrapper.
1441    pub fn object_id(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.object_id.as_ref() }
1442}
1443
1444#[derive(Default)]
1445pub struct FocusParamsBuilder<'a> {
1446    node_id: Option<NodeId>,
1447    backend_node_id: Option<BackendNodeId>,
1448    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1449}
1450
1451impl<'a> FocusParamsBuilder<'a> {
1452    /// Identifier of the node.
1453    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
1454    /// Identifier of the backend node.
1455    pub fn backend_node_id(mut self, backend_node_id: BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
1456    /// JavaScript object id of the node wrapper.
1457    pub fn object_id(mut self, object_id: crate::runtime::RemoteObjectId<'a>) -> Self { self.object_id = Some(object_id); self }
1458    pub fn build(self) -> FocusParams<'a> {
1459        FocusParams {
1460            node_id: self.node_id,
1461            backend_node_id: self.backend_node_id,
1462            object_id: self.object_id,
1463        }
1464    }
1465}
1466
1467impl<'a> FocusParams<'a> { pub const METHOD: &'static str = "DOM.focus"; }
1468
1469impl<'a> crate::CdpCommand<'a> for FocusParams<'a> {
1470    const METHOD: &'static str = "DOM.focus";
1471    type Response = crate::EmptyReturns;
1472}
1473
1474/// Returns attributes for the specified node.
1475
1476#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1477#[serde(rename_all = "camelCase")]
1478pub struct GetAttributesParams {
1479    /// Id of the node to retrieve attributes for.
1480    #[serde(rename = "nodeId")]
1481    node_id: NodeId,
1482}
1483
1484impl GetAttributesParams {
1485    /// Creates a builder for this type with the required parameters:
1486    /// * `node_id`: Id of the node to retrieve attributes for.
1487    pub fn builder(node_id: NodeId) -> GetAttributesParamsBuilder {
1488        GetAttributesParamsBuilder {
1489            node_id: node_id,
1490        }
1491    }
1492    /// Id of the node to retrieve attributes for.
1493    pub fn node_id(&self) -> &NodeId { &self.node_id }
1494}
1495
1496
1497pub struct GetAttributesParamsBuilder {
1498    node_id: NodeId,
1499}
1500
1501impl GetAttributesParamsBuilder {
1502    pub fn build(self) -> GetAttributesParams {
1503        GetAttributesParams {
1504            node_id: self.node_id,
1505        }
1506    }
1507}
1508
1509/// Returns attributes for the specified node.
1510
1511#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1512#[serde(rename_all = "camelCase")]
1513pub struct GetAttributesReturns<'a> {
1514    /// An interleaved array of node attribute names and values.
1515    attributes: Vec<Cow<'a, str>>,
1516}
1517
1518impl<'a> GetAttributesReturns<'a> {
1519    /// Creates a builder for this type with the required parameters:
1520    /// * `attributes`: An interleaved array of node attribute names and values.
1521    pub fn builder(attributes: Vec<Cow<'a, str>>) -> GetAttributesReturnsBuilder<'a> {
1522        GetAttributesReturnsBuilder {
1523            attributes: attributes,
1524        }
1525    }
1526    /// An interleaved array of node attribute names and values.
1527    pub fn attributes(&self) -> &[Cow<'a, str>] { &self.attributes }
1528}
1529
1530
1531pub struct GetAttributesReturnsBuilder<'a> {
1532    attributes: Vec<Cow<'a, str>>,
1533}
1534
1535impl<'a> GetAttributesReturnsBuilder<'a> {
1536    pub fn build(self) -> GetAttributesReturns<'a> {
1537        GetAttributesReturns {
1538            attributes: self.attributes,
1539        }
1540    }
1541}
1542
1543impl GetAttributesParams { pub const METHOD: &'static str = "DOM.getAttributes"; }
1544
1545impl<'a> crate::CdpCommand<'a> for GetAttributesParams {
1546    const METHOD: &'static str = "DOM.getAttributes";
1547    type Response = GetAttributesReturns<'a>;
1548}
1549
1550/// Returns boxes for the given node.
1551
1552#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1553#[serde(rename_all = "camelCase")]
1554pub struct GetBoxModelParams<'a> {
1555    /// Identifier of the node.
1556    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
1557    node_id: Option<NodeId>,
1558    /// Identifier of the backend node.
1559    #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
1560    backend_node_id: Option<BackendNodeId>,
1561    /// JavaScript object id of the node wrapper.
1562    #[serde(skip_serializing_if = "Option::is_none", rename = "objectId")]
1563    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1564}
1565
1566impl<'a> GetBoxModelParams<'a> {
1567    /// Creates a builder for this type.
1568    pub fn builder() -> GetBoxModelParamsBuilder<'a> {
1569        GetBoxModelParamsBuilder {
1570            node_id: None,
1571            backend_node_id: None,
1572            object_id: None,
1573        }
1574    }
1575    /// Identifier of the node.
1576    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
1577    /// Identifier of the backend node.
1578    pub fn backend_node_id(&self) -> Option<&BackendNodeId> { self.backend_node_id.as_ref() }
1579    /// JavaScript object id of the node wrapper.
1580    pub fn object_id(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.object_id.as_ref() }
1581}
1582
1583#[derive(Default)]
1584pub struct GetBoxModelParamsBuilder<'a> {
1585    node_id: Option<NodeId>,
1586    backend_node_id: Option<BackendNodeId>,
1587    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1588}
1589
1590impl<'a> GetBoxModelParamsBuilder<'a> {
1591    /// Identifier of the node.
1592    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
1593    /// Identifier of the backend node.
1594    pub fn backend_node_id(mut self, backend_node_id: BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
1595    /// JavaScript object id of the node wrapper.
1596    pub fn object_id(mut self, object_id: crate::runtime::RemoteObjectId<'a>) -> Self { self.object_id = Some(object_id); self }
1597    pub fn build(self) -> GetBoxModelParams<'a> {
1598        GetBoxModelParams {
1599            node_id: self.node_id,
1600            backend_node_id: self.backend_node_id,
1601            object_id: self.object_id,
1602        }
1603    }
1604}
1605
1606/// Returns boxes for the given node.
1607
1608#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1609#[serde(rename_all = "camelCase")]
1610pub struct GetBoxModelReturns {
1611    /// Box model for the node.
1612    model: BoxModel,
1613}
1614
1615impl GetBoxModelReturns {
1616    /// Creates a builder for this type with the required parameters:
1617    /// * `model`: Box model for the node.
1618    pub fn builder(model: BoxModel) -> GetBoxModelReturnsBuilder {
1619        GetBoxModelReturnsBuilder {
1620            model: model,
1621        }
1622    }
1623    /// Box model for the node.
1624    pub fn model(&self) -> &BoxModel { &self.model }
1625}
1626
1627
1628pub struct GetBoxModelReturnsBuilder {
1629    model: BoxModel,
1630}
1631
1632impl GetBoxModelReturnsBuilder {
1633    pub fn build(self) -> GetBoxModelReturns {
1634        GetBoxModelReturns {
1635            model: self.model,
1636        }
1637    }
1638}
1639
1640impl<'a> GetBoxModelParams<'a> { pub const METHOD: &'static str = "DOM.getBoxModel"; }
1641
1642impl<'a> crate::CdpCommand<'a> for GetBoxModelParams<'a> {
1643    const METHOD: &'static str = "DOM.getBoxModel";
1644    type Response = GetBoxModelReturns;
1645}
1646
1647/// Returns quads that describe node position on the page. This method
1648/// might return multiple quads for inline nodes.
1649
1650#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1651#[serde(rename_all = "camelCase")]
1652pub struct GetContentQuadsParams<'a> {
1653    /// Identifier of the node.
1654    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
1655    node_id: Option<NodeId>,
1656    /// Identifier of the backend node.
1657    #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
1658    backend_node_id: Option<BackendNodeId>,
1659    /// JavaScript object id of the node wrapper.
1660    #[serde(skip_serializing_if = "Option::is_none", rename = "objectId")]
1661    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1662}
1663
1664impl<'a> GetContentQuadsParams<'a> {
1665    /// Creates a builder for this type.
1666    pub fn builder() -> GetContentQuadsParamsBuilder<'a> {
1667        GetContentQuadsParamsBuilder {
1668            node_id: None,
1669            backend_node_id: None,
1670            object_id: None,
1671        }
1672    }
1673    /// Identifier of the node.
1674    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
1675    /// Identifier of the backend node.
1676    pub fn backend_node_id(&self) -> Option<&BackendNodeId> { self.backend_node_id.as_ref() }
1677    /// JavaScript object id of the node wrapper.
1678    pub fn object_id(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.object_id.as_ref() }
1679}
1680
1681#[derive(Default)]
1682pub struct GetContentQuadsParamsBuilder<'a> {
1683    node_id: Option<NodeId>,
1684    backend_node_id: Option<BackendNodeId>,
1685    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
1686}
1687
1688impl<'a> GetContentQuadsParamsBuilder<'a> {
1689    /// Identifier of the node.
1690    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
1691    /// Identifier of the backend node.
1692    pub fn backend_node_id(mut self, backend_node_id: BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
1693    /// JavaScript object id of the node wrapper.
1694    pub fn object_id(mut self, object_id: crate::runtime::RemoteObjectId<'a>) -> Self { self.object_id = Some(object_id); self }
1695    pub fn build(self) -> GetContentQuadsParams<'a> {
1696        GetContentQuadsParams {
1697            node_id: self.node_id,
1698            backend_node_id: self.backend_node_id,
1699            object_id: self.object_id,
1700        }
1701    }
1702}
1703
1704/// Returns quads that describe node position on the page. This method
1705/// might return multiple quads for inline nodes.
1706
1707#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1708#[serde(rename_all = "camelCase")]
1709pub struct GetContentQuadsReturns {
1710    /// Quads that describe node layout relative to viewport.
1711    quads: Vec<Quad>,
1712}
1713
1714impl GetContentQuadsReturns {
1715    /// Creates a builder for this type with the required parameters:
1716    /// * `quads`: Quads that describe node layout relative to viewport.
1717    pub fn builder(quads: Vec<Quad>) -> GetContentQuadsReturnsBuilder {
1718        GetContentQuadsReturnsBuilder {
1719            quads: quads,
1720        }
1721    }
1722    /// Quads that describe node layout relative to viewport.
1723    pub fn quads(&self) -> &[Quad] { &self.quads }
1724}
1725
1726
1727pub struct GetContentQuadsReturnsBuilder {
1728    quads: Vec<Quad>,
1729}
1730
1731impl GetContentQuadsReturnsBuilder {
1732    pub fn build(self) -> GetContentQuadsReturns {
1733        GetContentQuadsReturns {
1734            quads: self.quads,
1735        }
1736    }
1737}
1738
1739impl<'a> GetContentQuadsParams<'a> { pub const METHOD: &'static str = "DOM.getContentQuads"; }
1740
1741impl<'a> crate::CdpCommand<'a> for GetContentQuadsParams<'a> {
1742    const METHOD: &'static str = "DOM.getContentQuads";
1743    type Response = GetContentQuadsReturns;
1744}
1745
1746/// Returns the root DOM node (and optionally the subtree) to the caller.
1747/// Implicitly enables the DOM domain events for the current target.
1748
1749#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1750#[serde(rename_all = "camelCase")]
1751pub struct GetDocumentParams {
1752    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1753    /// entire subtree or provide an integer larger than 0.
1754    #[serde(skip_serializing_if = "Option::is_none")]
1755    depth: Option<i64>,
1756    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1757    /// (default is false).
1758    #[serde(skip_serializing_if = "Option::is_none")]
1759    pierce: Option<bool>,
1760}
1761
1762impl GetDocumentParams {
1763    /// Creates a builder for this type.
1764    pub fn builder() -> GetDocumentParamsBuilder {
1765        GetDocumentParamsBuilder {
1766            depth: None,
1767            pierce: None,
1768        }
1769    }
1770    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1771    /// entire subtree or provide an integer larger than 0.
1772    pub fn depth(&self) -> Option<i64> { self.depth }
1773    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1774    /// (default is false).
1775    pub fn pierce(&self) -> Option<bool> { self.pierce }
1776}
1777
1778#[derive(Default)]
1779pub struct GetDocumentParamsBuilder {
1780    depth: Option<i64>,
1781    pierce: Option<bool>,
1782}
1783
1784impl GetDocumentParamsBuilder {
1785    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1786    /// entire subtree or provide an integer larger than 0.
1787    pub fn depth(mut self, depth: i64) -> Self { self.depth = Some(depth); self }
1788    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1789    /// (default is false).
1790    pub fn pierce(mut self, pierce: bool) -> Self { self.pierce = Some(pierce); self }
1791    pub fn build(self) -> GetDocumentParams {
1792        GetDocumentParams {
1793            depth: self.depth,
1794            pierce: self.pierce,
1795        }
1796    }
1797}
1798
1799/// Returns the root DOM node (and optionally the subtree) to the caller.
1800/// Implicitly enables the DOM domain events for the current target.
1801
1802#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1803#[serde(rename_all = "camelCase")]
1804pub struct GetDocumentReturns<'a> {
1805    /// Resulting node.
1806    root: Node<'a>,
1807}
1808
1809impl<'a> GetDocumentReturns<'a> {
1810    /// Creates a builder for this type with the required parameters:
1811    /// * `root`: Resulting node.
1812    pub fn builder(root: Node<'a>) -> GetDocumentReturnsBuilder<'a> {
1813        GetDocumentReturnsBuilder {
1814            root: root,
1815        }
1816    }
1817    /// Resulting node.
1818    pub fn root(&self) -> &Node<'a> { &self.root }
1819}
1820
1821
1822pub struct GetDocumentReturnsBuilder<'a> {
1823    root: Node<'a>,
1824}
1825
1826impl<'a> GetDocumentReturnsBuilder<'a> {
1827    pub fn build(self) -> GetDocumentReturns<'a> {
1828        GetDocumentReturns {
1829            root: self.root,
1830        }
1831    }
1832}
1833
1834impl GetDocumentParams { pub const METHOD: &'static str = "DOM.getDocument"; }
1835
1836impl<'a> crate::CdpCommand<'a> for GetDocumentParams {
1837    const METHOD: &'static str = "DOM.getDocument";
1838    type Response = GetDocumentReturns<'a>;
1839}
1840
1841/// Returns the root DOM node (and optionally the subtree) to the caller.
1842/// Deprecated, as it is not designed to work well with the rest of the DOM agent.
1843/// Use DOMSnapshot.captureSnapshot instead.
1844
1845#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1846#[serde(rename_all = "camelCase")]
1847pub struct GetFlattenedDocumentParams {
1848    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1849    /// entire subtree or provide an integer larger than 0.
1850    #[serde(skip_serializing_if = "Option::is_none")]
1851    depth: Option<i64>,
1852    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1853    /// (default is false).
1854    #[serde(skip_serializing_if = "Option::is_none")]
1855    pierce: Option<bool>,
1856}
1857
1858impl GetFlattenedDocumentParams {
1859    /// Creates a builder for this type.
1860    pub fn builder() -> GetFlattenedDocumentParamsBuilder {
1861        GetFlattenedDocumentParamsBuilder {
1862            depth: None,
1863            pierce: None,
1864        }
1865    }
1866    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1867    /// entire subtree or provide an integer larger than 0.
1868    pub fn depth(&self) -> Option<i64> { self.depth }
1869    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1870    /// (default is false).
1871    pub fn pierce(&self) -> Option<bool> { self.pierce }
1872}
1873
1874#[derive(Default)]
1875pub struct GetFlattenedDocumentParamsBuilder {
1876    depth: Option<i64>,
1877    pierce: Option<bool>,
1878}
1879
1880impl GetFlattenedDocumentParamsBuilder {
1881    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1882    /// entire subtree or provide an integer larger than 0.
1883    pub fn depth(mut self, depth: i64) -> Self { self.depth = Some(depth); self }
1884    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
1885    /// (default is false).
1886    pub fn pierce(mut self, pierce: bool) -> Self { self.pierce = Some(pierce); self }
1887    pub fn build(self) -> GetFlattenedDocumentParams {
1888        GetFlattenedDocumentParams {
1889            depth: self.depth,
1890            pierce: self.pierce,
1891        }
1892    }
1893}
1894
1895/// Returns the root DOM node (and optionally the subtree) to the caller.
1896/// Deprecated, as it is not designed to work well with the rest of the DOM agent.
1897/// Use DOMSnapshot.captureSnapshot instead.
1898
1899#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1900#[serde(rename_all = "camelCase")]
1901pub struct GetFlattenedDocumentReturns<'a> {
1902    /// Resulting node.
1903    nodes: Vec<Node<'a>>,
1904}
1905
1906impl<'a> GetFlattenedDocumentReturns<'a> {
1907    /// Creates a builder for this type with the required parameters:
1908    /// * `nodes`: Resulting node.
1909    pub fn builder(nodes: Vec<Node<'a>>) -> GetFlattenedDocumentReturnsBuilder<'a> {
1910        GetFlattenedDocumentReturnsBuilder {
1911            nodes: nodes,
1912        }
1913    }
1914    /// Resulting node.
1915    pub fn nodes(&self) -> &[Node<'a>] { &self.nodes }
1916}
1917
1918
1919pub struct GetFlattenedDocumentReturnsBuilder<'a> {
1920    nodes: Vec<Node<'a>>,
1921}
1922
1923impl<'a> GetFlattenedDocumentReturnsBuilder<'a> {
1924    pub fn build(self) -> GetFlattenedDocumentReturns<'a> {
1925        GetFlattenedDocumentReturns {
1926            nodes: self.nodes,
1927        }
1928    }
1929}
1930
1931impl GetFlattenedDocumentParams { pub const METHOD: &'static str = "DOM.getFlattenedDocument"; }
1932
1933impl<'a> crate::CdpCommand<'a> for GetFlattenedDocumentParams {
1934    const METHOD: &'static str = "DOM.getFlattenedDocument";
1935    type Response = GetFlattenedDocumentReturns<'a>;
1936}
1937
1938/// Finds nodes with a given computed style in a subtree.
1939
1940#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1941#[serde(rename_all = "camelCase")]
1942pub struct GetNodesForSubtreeByStyleParams<'a> {
1943    /// Node ID pointing to the root of a subtree.
1944    #[serde(rename = "nodeId")]
1945    node_id: NodeId,
1946    /// The style to filter nodes by (includes nodes if any of properties matches).
1947    #[serde(rename = "computedStyles")]
1948    computed_styles: Vec<CSSComputedStyleProperty<'a>>,
1949    /// Whether or not iframes and shadow roots in the same target should be traversed when returning the
1950    /// results (default is false).
1951    #[serde(skip_serializing_if = "Option::is_none")]
1952    pierce: Option<bool>,
1953}
1954
1955impl<'a> GetNodesForSubtreeByStyleParams<'a> {
1956    /// Creates a builder for this type with the required parameters:
1957    /// * `node_id`: Node ID pointing to the root of a subtree.
1958    /// * `computed_styles`: The style to filter nodes by (includes nodes if any of properties matches).
1959    pub fn builder(node_id: NodeId, computed_styles: Vec<CSSComputedStyleProperty<'a>>) -> GetNodesForSubtreeByStyleParamsBuilder<'a> {
1960        GetNodesForSubtreeByStyleParamsBuilder {
1961            node_id: node_id,
1962            computed_styles: computed_styles,
1963            pierce: None,
1964        }
1965    }
1966    /// Node ID pointing to the root of a subtree.
1967    pub fn node_id(&self) -> &NodeId { &self.node_id }
1968    /// The style to filter nodes by (includes nodes if any of properties matches).
1969    pub fn computed_styles(&self) -> &[CSSComputedStyleProperty<'a>] { &self.computed_styles }
1970    /// Whether or not iframes and shadow roots in the same target should be traversed when returning the
1971    /// results (default is false).
1972    pub fn pierce(&self) -> Option<bool> { self.pierce }
1973}
1974
1975
1976pub struct GetNodesForSubtreeByStyleParamsBuilder<'a> {
1977    node_id: NodeId,
1978    computed_styles: Vec<CSSComputedStyleProperty<'a>>,
1979    pierce: Option<bool>,
1980}
1981
1982impl<'a> GetNodesForSubtreeByStyleParamsBuilder<'a> {
1983    /// Whether or not iframes and shadow roots in the same target should be traversed when returning the
1984    /// results (default is false).
1985    pub fn pierce(mut self, pierce: bool) -> Self { self.pierce = Some(pierce); self }
1986    pub fn build(self) -> GetNodesForSubtreeByStyleParams<'a> {
1987        GetNodesForSubtreeByStyleParams {
1988            node_id: self.node_id,
1989            computed_styles: self.computed_styles,
1990            pierce: self.pierce,
1991        }
1992    }
1993}
1994
1995/// Finds nodes with a given computed style in a subtree.
1996
1997#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1998#[serde(rename_all = "camelCase")]
1999pub struct GetNodesForSubtreeByStyleReturns {
2000    /// Resulting nodes.
2001    #[serde(rename = "nodeIds")]
2002    node_ids: Vec<NodeId>,
2003}
2004
2005impl GetNodesForSubtreeByStyleReturns {
2006    /// Creates a builder for this type with the required parameters:
2007    /// * `node_ids`: Resulting nodes.
2008    pub fn builder(node_ids: Vec<NodeId>) -> GetNodesForSubtreeByStyleReturnsBuilder {
2009        GetNodesForSubtreeByStyleReturnsBuilder {
2010            node_ids: node_ids,
2011        }
2012    }
2013    /// Resulting nodes.
2014    pub fn node_ids(&self) -> &[NodeId] { &self.node_ids }
2015}
2016
2017
2018pub struct GetNodesForSubtreeByStyleReturnsBuilder {
2019    node_ids: Vec<NodeId>,
2020}
2021
2022impl GetNodesForSubtreeByStyleReturnsBuilder {
2023    pub fn build(self) -> GetNodesForSubtreeByStyleReturns {
2024        GetNodesForSubtreeByStyleReturns {
2025            node_ids: self.node_ids,
2026        }
2027    }
2028}
2029
2030impl<'a> GetNodesForSubtreeByStyleParams<'a> { pub const METHOD: &'static str = "DOM.getNodesForSubtreeByStyle"; }
2031
2032impl<'a> crate::CdpCommand<'a> for GetNodesForSubtreeByStyleParams<'a> {
2033    const METHOD: &'static str = "DOM.getNodesForSubtreeByStyle";
2034    type Response = GetNodesForSubtreeByStyleReturns;
2035}
2036
2037/// Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is
2038/// either returned or not.
2039
2040#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2041#[serde(rename_all = "camelCase")]
2042pub struct GetNodeForLocationParams {
2043    /// X coordinate.
2044    x: i32,
2045    /// Y coordinate.
2046    y: i32,
2047    /// False to skip to the nearest non-UA shadow root ancestor (default: false).
2048    #[serde(skip_serializing_if = "Option::is_none", rename = "includeUserAgentShadowDOM")]
2049    include_user_agent_shadow_dom: Option<bool>,
2050    /// Whether to ignore pointer-events: none on elements and hit test them.
2051    #[serde(skip_serializing_if = "Option::is_none", rename = "ignorePointerEventsNone")]
2052    ignore_pointer_events_none: Option<bool>,
2053}
2054
2055impl GetNodeForLocationParams {
2056    /// Creates a builder for this type with the required parameters:
2057    /// * `x`: X coordinate.
2058    /// * `y`: Y coordinate.
2059    pub fn builder(x: i32, y: i32) -> GetNodeForLocationParamsBuilder {
2060        GetNodeForLocationParamsBuilder {
2061            x: x,
2062            y: y,
2063            include_user_agent_shadow_dom: None,
2064            ignore_pointer_events_none: None,
2065        }
2066    }
2067    /// X coordinate.
2068    pub fn x(&self) -> i32 { self.x }
2069    /// Y coordinate.
2070    pub fn y(&self) -> i32 { self.y }
2071    /// False to skip to the nearest non-UA shadow root ancestor (default: false).
2072    pub fn include_user_agent_shadow_dom(&self) -> Option<bool> { self.include_user_agent_shadow_dom }
2073    /// Whether to ignore pointer-events: none on elements and hit test them.
2074    pub fn ignore_pointer_events_none(&self) -> Option<bool> { self.ignore_pointer_events_none }
2075}
2076
2077
2078pub struct GetNodeForLocationParamsBuilder {
2079    x: i32,
2080    y: i32,
2081    include_user_agent_shadow_dom: Option<bool>,
2082    ignore_pointer_events_none: Option<bool>,
2083}
2084
2085impl GetNodeForLocationParamsBuilder {
2086    /// False to skip to the nearest non-UA shadow root ancestor (default: false).
2087    pub fn include_user_agent_shadow_dom(mut self, include_user_agent_shadow_dom: bool) -> Self { self.include_user_agent_shadow_dom = Some(include_user_agent_shadow_dom); self }
2088    /// Whether to ignore pointer-events: none on elements and hit test them.
2089    pub fn ignore_pointer_events_none(mut self, ignore_pointer_events_none: bool) -> Self { self.ignore_pointer_events_none = Some(ignore_pointer_events_none); self }
2090    pub fn build(self) -> GetNodeForLocationParams {
2091        GetNodeForLocationParams {
2092            x: self.x,
2093            y: self.y,
2094            include_user_agent_shadow_dom: self.include_user_agent_shadow_dom,
2095            ignore_pointer_events_none: self.ignore_pointer_events_none,
2096        }
2097    }
2098}
2099
2100/// Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is
2101/// either returned or not.
2102
2103#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2104#[serde(rename_all = "camelCase")]
2105pub struct GetNodeForLocationReturns<'a> {
2106    /// Resulting node.
2107    #[serde(rename = "backendNodeId")]
2108    backend_node_id: BackendNodeId,
2109    /// Frame this node belongs to.
2110    #[serde(rename = "frameId")]
2111    frame_id: crate::page::FrameId<'a>,
2112    /// Id of the node at given coordinates, only when enabled and requested document.
2113    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
2114    node_id: Option<NodeId>,
2115}
2116
2117impl<'a> GetNodeForLocationReturns<'a> {
2118    /// Creates a builder for this type with the required parameters:
2119    /// * `backend_node_id`: Resulting node.
2120    /// * `frame_id`: Frame this node belongs to.
2121    pub fn builder(backend_node_id: BackendNodeId, frame_id: crate::page::FrameId<'a>) -> GetNodeForLocationReturnsBuilder<'a> {
2122        GetNodeForLocationReturnsBuilder {
2123            backend_node_id: backend_node_id,
2124            frame_id: frame_id,
2125            node_id: None,
2126        }
2127    }
2128    /// Resulting node.
2129    pub fn backend_node_id(&self) -> &BackendNodeId { &self.backend_node_id }
2130    /// Frame this node belongs to.
2131    pub fn frame_id(&self) -> &crate::page::FrameId<'a> { &self.frame_id }
2132    /// Id of the node at given coordinates, only when enabled and requested document.
2133    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
2134}
2135
2136
2137pub struct GetNodeForLocationReturnsBuilder<'a> {
2138    backend_node_id: BackendNodeId,
2139    frame_id: crate::page::FrameId<'a>,
2140    node_id: Option<NodeId>,
2141}
2142
2143impl<'a> GetNodeForLocationReturnsBuilder<'a> {
2144    /// Id of the node at given coordinates, only when enabled and requested document.
2145    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
2146    pub fn build(self) -> GetNodeForLocationReturns<'a> {
2147        GetNodeForLocationReturns {
2148            backend_node_id: self.backend_node_id,
2149            frame_id: self.frame_id,
2150            node_id: self.node_id,
2151        }
2152    }
2153}
2154
2155impl GetNodeForLocationParams { pub const METHOD: &'static str = "DOM.getNodeForLocation"; }
2156
2157impl<'a> crate::CdpCommand<'a> for GetNodeForLocationParams {
2158    const METHOD: &'static str = "DOM.getNodeForLocation";
2159    type Response = GetNodeForLocationReturns<'a>;
2160}
2161
2162/// Returns node's HTML markup.
2163
2164#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2165#[serde(rename_all = "camelCase")]
2166pub struct GetOuterHTMLParams<'a> {
2167    /// Identifier of the node.
2168    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
2169    node_id: Option<NodeId>,
2170    /// Identifier of the backend node.
2171    #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
2172    backend_node_id: Option<BackendNodeId>,
2173    /// JavaScript object id of the node wrapper.
2174    #[serde(skip_serializing_if = "Option::is_none", rename = "objectId")]
2175    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
2176    /// Include all shadow roots. Equals to false if not specified.
2177    #[serde(skip_serializing_if = "Option::is_none", rename = "includeShadowDOM")]
2178    include_shadow_dom: Option<bool>,
2179}
2180
2181impl<'a> GetOuterHTMLParams<'a> {
2182    /// Creates a builder for this type.
2183    pub fn builder() -> GetOuterHTMLParamsBuilder<'a> {
2184        GetOuterHTMLParamsBuilder {
2185            node_id: None,
2186            backend_node_id: None,
2187            object_id: None,
2188            include_shadow_dom: None,
2189        }
2190    }
2191    /// Identifier of the node.
2192    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
2193    /// Identifier of the backend node.
2194    pub fn backend_node_id(&self) -> Option<&BackendNodeId> { self.backend_node_id.as_ref() }
2195    /// JavaScript object id of the node wrapper.
2196    pub fn object_id(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.object_id.as_ref() }
2197    /// Include all shadow roots. Equals to false if not specified.
2198    pub fn include_shadow_dom(&self) -> Option<bool> { self.include_shadow_dom }
2199}
2200
2201#[derive(Default)]
2202pub struct GetOuterHTMLParamsBuilder<'a> {
2203    node_id: Option<NodeId>,
2204    backend_node_id: Option<BackendNodeId>,
2205    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
2206    include_shadow_dom: Option<bool>,
2207}
2208
2209impl<'a> GetOuterHTMLParamsBuilder<'a> {
2210    /// Identifier of the node.
2211    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
2212    /// Identifier of the backend node.
2213    pub fn backend_node_id(mut self, backend_node_id: BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
2214    /// JavaScript object id of the node wrapper.
2215    pub fn object_id(mut self, object_id: crate::runtime::RemoteObjectId<'a>) -> Self { self.object_id = Some(object_id); self }
2216    /// Include all shadow roots. Equals to false if not specified.
2217    pub fn include_shadow_dom(mut self, include_shadow_dom: bool) -> Self { self.include_shadow_dom = Some(include_shadow_dom); self }
2218    pub fn build(self) -> GetOuterHTMLParams<'a> {
2219        GetOuterHTMLParams {
2220            node_id: self.node_id,
2221            backend_node_id: self.backend_node_id,
2222            object_id: self.object_id,
2223            include_shadow_dom: self.include_shadow_dom,
2224        }
2225    }
2226}
2227
2228/// Returns node's HTML markup.
2229
2230#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2231#[serde(rename_all = "camelCase")]
2232pub struct GetOuterHTMLReturns<'a> {
2233    /// Outer HTML markup.
2234    #[serde(rename = "outerHTML")]
2235    outer_html: Cow<'a, str>,
2236}
2237
2238impl<'a> GetOuterHTMLReturns<'a> {
2239    /// Creates a builder for this type with the required parameters:
2240    /// * `outer_html`: Outer HTML markup.
2241    pub fn builder(outer_html: impl Into<Cow<'a, str>>) -> GetOuterHTMLReturnsBuilder<'a> {
2242        GetOuterHTMLReturnsBuilder {
2243            outer_html: outer_html.into(),
2244        }
2245    }
2246    /// Outer HTML markup.
2247    pub fn outer_html(&self) -> &str { self.outer_html.as_ref() }
2248}
2249
2250
2251pub struct GetOuterHTMLReturnsBuilder<'a> {
2252    outer_html: Cow<'a, str>,
2253}
2254
2255impl<'a> GetOuterHTMLReturnsBuilder<'a> {
2256    pub fn build(self) -> GetOuterHTMLReturns<'a> {
2257        GetOuterHTMLReturns {
2258            outer_html: self.outer_html,
2259        }
2260    }
2261}
2262
2263impl<'a> GetOuterHTMLParams<'a> { pub const METHOD: &'static str = "DOM.getOuterHTML"; }
2264
2265impl<'a> crate::CdpCommand<'a> for GetOuterHTMLParams<'a> {
2266    const METHOD: &'static str = "DOM.getOuterHTML";
2267    type Response = GetOuterHTMLReturns<'a>;
2268}
2269
2270/// Returns the id of the nearest ancestor that is a relayout boundary.
2271
2272#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2273#[serde(rename_all = "camelCase")]
2274pub struct GetRelayoutBoundaryParams {
2275    /// Id of the node.
2276    #[serde(rename = "nodeId")]
2277    node_id: NodeId,
2278}
2279
2280impl GetRelayoutBoundaryParams {
2281    /// Creates a builder for this type with the required parameters:
2282    /// * `node_id`: Id of the node.
2283    pub fn builder(node_id: NodeId) -> GetRelayoutBoundaryParamsBuilder {
2284        GetRelayoutBoundaryParamsBuilder {
2285            node_id: node_id,
2286        }
2287    }
2288    /// Id of the node.
2289    pub fn node_id(&self) -> &NodeId { &self.node_id }
2290}
2291
2292
2293pub struct GetRelayoutBoundaryParamsBuilder {
2294    node_id: NodeId,
2295}
2296
2297impl GetRelayoutBoundaryParamsBuilder {
2298    pub fn build(self) -> GetRelayoutBoundaryParams {
2299        GetRelayoutBoundaryParams {
2300            node_id: self.node_id,
2301        }
2302    }
2303}
2304
2305/// Returns the id of the nearest ancestor that is a relayout boundary.
2306
2307#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2308#[serde(rename_all = "camelCase")]
2309pub struct GetRelayoutBoundaryReturns {
2310    /// Relayout boundary node id for the given node.
2311    #[serde(rename = "nodeId")]
2312    node_id: NodeId,
2313}
2314
2315impl GetRelayoutBoundaryReturns {
2316    /// Creates a builder for this type with the required parameters:
2317    /// * `node_id`: Relayout boundary node id for the given node.
2318    pub fn builder(node_id: NodeId) -> GetRelayoutBoundaryReturnsBuilder {
2319        GetRelayoutBoundaryReturnsBuilder {
2320            node_id: node_id,
2321        }
2322    }
2323    /// Relayout boundary node id for the given node.
2324    pub fn node_id(&self) -> &NodeId { &self.node_id }
2325}
2326
2327
2328pub struct GetRelayoutBoundaryReturnsBuilder {
2329    node_id: NodeId,
2330}
2331
2332impl GetRelayoutBoundaryReturnsBuilder {
2333    pub fn build(self) -> GetRelayoutBoundaryReturns {
2334        GetRelayoutBoundaryReturns {
2335            node_id: self.node_id,
2336        }
2337    }
2338}
2339
2340impl GetRelayoutBoundaryParams { pub const METHOD: &'static str = "DOM.getRelayoutBoundary"; }
2341
2342impl<'a> crate::CdpCommand<'a> for GetRelayoutBoundaryParams {
2343    const METHOD: &'static str = "DOM.getRelayoutBoundary";
2344    type Response = GetRelayoutBoundaryReturns;
2345}
2346
2347/// Returns search results from given 'fromIndex' to given 'toIndex' from the search with the given
2348/// identifier.
2349
2350#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2351#[serde(rename_all = "camelCase")]
2352pub struct GetSearchResultsParams<'a> {
2353    /// Unique search session identifier.
2354    #[serde(rename = "searchId")]
2355    search_id: Cow<'a, str>,
2356    /// Start index of the search result to be returned.
2357    #[serde(rename = "fromIndex")]
2358    from_index: u64,
2359    /// End index of the search result to be returned.
2360    #[serde(rename = "toIndex")]
2361    to_index: u64,
2362}
2363
2364impl<'a> GetSearchResultsParams<'a> {
2365    /// Creates a builder for this type with the required parameters:
2366    /// * `search_id`: Unique search session identifier.
2367    /// * `from_index`: Start index of the search result to be returned.
2368    /// * `to_index`: End index of the search result to be returned.
2369    pub fn builder(search_id: impl Into<Cow<'a, str>>, from_index: u64, to_index: u64) -> GetSearchResultsParamsBuilder<'a> {
2370        GetSearchResultsParamsBuilder {
2371            search_id: search_id.into(),
2372            from_index: from_index,
2373            to_index: to_index,
2374        }
2375    }
2376    /// Unique search session identifier.
2377    pub fn search_id(&self) -> &str { self.search_id.as_ref() }
2378    /// Start index of the search result to be returned.
2379    pub fn from_index(&self) -> u64 { self.from_index }
2380    /// End index of the search result to be returned.
2381    pub fn to_index(&self) -> u64 { self.to_index }
2382}
2383
2384
2385pub struct GetSearchResultsParamsBuilder<'a> {
2386    search_id: Cow<'a, str>,
2387    from_index: u64,
2388    to_index: u64,
2389}
2390
2391impl<'a> GetSearchResultsParamsBuilder<'a> {
2392    pub fn build(self) -> GetSearchResultsParams<'a> {
2393        GetSearchResultsParams {
2394            search_id: self.search_id,
2395            from_index: self.from_index,
2396            to_index: self.to_index,
2397        }
2398    }
2399}
2400
2401/// Returns search results from given 'fromIndex' to given 'toIndex' from the search with the given
2402/// identifier.
2403
2404#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2405#[serde(rename_all = "camelCase")]
2406pub struct GetSearchResultsReturns {
2407    /// Ids of the search result nodes.
2408    #[serde(rename = "nodeIds")]
2409    node_ids: Vec<NodeId>,
2410}
2411
2412impl GetSearchResultsReturns {
2413    /// Creates a builder for this type with the required parameters:
2414    /// * `node_ids`: Ids of the search result nodes.
2415    pub fn builder(node_ids: Vec<NodeId>) -> GetSearchResultsReturnsBuilder {
2416        GetSearchResultsReturnsBuilder {
2417            node_ids: node_ids,
2418        }
2419    }
2420    /// Ids of the search result nodes.
2421    pub fn node_ids(&self) -> &[NodeId] { &self.node_ids }
2422}
2423
2424
2425pub struct GetSearchResultsReturnsBuilder {
2426    node_ids: Vec<NodeId>,
2427}
2428
2429impl GetSearchResultsReturnsBuilder {
2430    pub fn build(self) -> GetSearchResultsReturns {
2431        GetSearchResultsReturns {
2432            node_ids: self.node_ids,
2433        }
2434    }
2435}
2436
2437impl<'a> GetSearchResultsParams<'a> { pub const METHOD: &'static str = "DOM.getSearchResults"; }
2438
2439impl<'a> crate::CdpCommand<'a> for GetSearchResultsParams<'a> {
2440    const METHOD: &'static str = "DOM.getSearchResults";
2441    type Response = GetSearchResultsReturns;
2442}
2443
2444#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2445pub struct HideHighlightParams {}
2446
2447impl HideHighlightParams { pub const METHOD: &'static str = "DOM.hideHighlight"; }
2448
2449impl<'a> crate::CdpCommand<'a> for HideHighlightParams {
2450    const METHOD: &'static str = "DOM.hideHighlight";
2451    type Response = crate::EmptyReturns;
2452}
2453
2454#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2455pub struct HighlightNodeParams {}
2456
2457impl HighlightNodeParams { pub const METHOD: &'static str = "DOM.highlightNode"; }
2458
2459impl<'a> crate::CdpCommand<'a> for HighlightNodeParams {
2460    const METHOD: &'static str = "DOM.highlightNode";
2461    type Response = crate::EmptyReturns;
2462}
2463
2464#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2465pub struct HighlightRectParams {}
2466
2467impl HighlightRectParams { pub const METHOD: &'static str = "DOM.highlightRect"; }
2468
2469impl<'a> crate::CdpCommand<'a> for HighlightRectParams {
2470    const METHOD: &'static str = "DOM.highlightRect";
2471    type Response = crate::EmptyReturns;
2472}
2473
2474#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2475pub struct MarkUndoableStateParams {}
2476
2477impl MarkUndoableStateParams { pub const METHOD: &'static str = "DOM.markUndoableState"; }
2478
2479impl<'a> crate::CdpCommand<'a> for MarkUndoableStateParams {
2480    const METHOD: &'static str = "DOM.markUndoableState";
2481    type Response = crate::EmptyReturns;
2482}
2483
2484/// Moves node into the new container, places it before the given anchor.
2485
2486#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2487#[serde(rename_all = "camelCase")]
2488pub struct MoveToParams {
2489    /// Id of the node to move.
2490    #[serde(rename = "nodeId")]
2491    node_id: NodeId,
2492    /// Id of the element to drop the moved node into.
2493    #[serde(rename = "targetNodeId")]
2494    target_node_id: NodeId,
2495    /// Drop node before this one (if absent, the moved node becomes the last child of
2496    /// 'targetNodeId').
2497    #[serde(skip_serializing_if = "Option::is_none", rename = "insertBeforeNodeId")]
2498    insert_before_node_id: Option<NodeId>,
2499}
2500
2501impl MoveToParams {
2502    /// Creates a builder for this type with the required parameters:
2503    /// * `node_id`: Id of the node to move.
2504    /// * `target_node_id`: Id of the element to drop the moved node into.
2505    pub fn builder(node_id: NodeId, target_node_id: NodeId) -> MoveToParamsBuilder {
2506        MoveToParamsBuilder {
2507            node_id: node_id,
2508            target_node_id: target_node_id,
2509            insert_before_node_id: None,
2510        }
2511    }
2512    /// Id of the node to move.
2513    pub fn node_id(&self) -> &NodeId { &self.node_id }
2514    /// Id of the element to drop the moved node into.
2515    pub fn target_node_id(&self) -> &NodeId { &self.target_node_id }
2516    /// Drop node before this one (if absent, the moved node becomes the last child of
2517    /// 'targetNodeId').
2518    pub fn insert_before_node_id(&self) -> Option<&NodeId> { self.insert_before_node_id.as_ref() }
2519}
2520
2521
2522pub struct MoveToParamsBuilder {
2523    node_id: NodeId,
2524    target_node_id: NodeId,
2525    insert_before_node_id: Option<NodeId>,
2526}
2527
2528impl MoveToParamsBuilder {
2529    /// Drop node before this one (if absent, the moved node becomes the last child of
2530    /// 'targetNodeId').
2531    pub fn insert_before_node_id(mut self, insert_before_node_id: NodeId) -> Self { self.insert_before_node_id = Some(insert_before_node_id); self }
2532    pub fn build(self) -> MoveToParams {
2533        MoveToParams {
2534            node_id: self.node_id,
2535            target_node_id: self.target_node_id,
2536            insert_before_node_id: self.insert_before_node_id,
2537        }
2538    }
2539}
2540
2541/// Moves node into the new container, places it before the given anchor.
2542
2543#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2544#[serde(rename_all = "camelCase")]
2545pub struct MoveToReturns {
2546    /// New id of the moved node.
2547    #[serde(rename = "nodeId")]
2548    node_id: NodeId,
2549}
2550
2551impl MoveToReturns {
2552    /// Creates a builder for this type with the required parameters:
2553    /// * `node_id`: New id of the moved node.
2554    pub fn builder(node_id: NodeId) -> MoveToReturnsBuilder {
2555        MoveToReturnsBuilder {
2556            node_id: node_id,
2557        }
2558    }
2559    /// New id of the moved node.
2560    pub fn node_id(&self) -> &NodeId { &self.node_id }
2561}
2562
2563
2564pub struct MoveToReturnsBuilder {
2565    node_id: NodeId,
2566}
2567
2568impl MoveToReturnsBuilder {
2569    pub fn build(self) -> MoveToReturns {
2570        MoveToReturns {
2571            node_id: self.node_id,
2572        }
2573    }
2574}
2575
2576impl MoveToParams { pub const METHOD: &'static str = "DOM.moveTo"; }
2577
2578impl<'a> crate::CdpCommand<'a> for MoveToParams {
2579    const METHOD: &'static str = "DOM.moveTo";
2580    type Response = MoveToReturns;
2581}
2582
2583/// Searches for a given string in the DOM tree. Use 'getSearchResults' to access search results or
2584/// 'cancelSearch' to end this search session.
2585
2586#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2587#[serde(rename_all = "camelCase")]
2588pub struct PerformSearchParams<'a> {
2589    /// Plain text or query selector or XPath search query.
2590    query: Cow<'a, str>,
2591    /// True to search in user agent shadow DOM.
2592    #[serde(skip_serializing_if = "Option::is_none", rename = "includeUserAgentShadowDOM")]
2593    include_user_agent_shadow_dom: Option<bool>,
2594}
2595
2596impl<'a> PerformSearchParams<'a> {
2597    /// Creates a builder for this type with the required parameters:
2598    /// * `query`: Plain text or query selector or XPath search query.
2599    pub fn builder(query: impl Into<Cow<'a, str>>) -> PerformSearchParamsBuilder<'a> {
2600        PerformSearchParamsBuilder {
2601            query: query.into(),
2602            include_user_agent_shadow_dom: None,
2603        }
2604    }
2605    /// Plain text or query selector or XPath search query.
2606    pub fn query(&self) -> &str { self.query.as_ref() }
2607    /// True to search in user agent shadow DOM.
2608    pub fn include_user_agent_shadow_dom(&self) -> Option<bool> { self.include_user_agent_shadow_dom }
2609}
2610
2611
2612pub struct PerformSearchParamsBuilder<'a> {
2613    query: Cow<'a, str>,
2614    include_user_agent_shadow_dom: Option<bool>,
2615}
2616
2617impl<'a> PerformSearchParamsBuilder<'a> {
2618    /// True to search in user agent shadow DOM.
2619    pub fn include_user_agent_shadow_dom(mut self, include_user_agent_shadow_dom: bool) -> Self { self.include_user_agent_shadow_dom = Some(include_user_agent_shadow_dom); self }
2620    pub fn build(self) -> PerformSearchParams<'a> {
2621        PerformSearchParams {
2622            query: self.query,
2623            include_user_agent_shadow_dom: self.include_user_agent_shadow_dom,
2624        }
2625    }
2626}
2627
2628/// Searches for a given string in the DOM tree. Use 'getSearchResults' to access search results or
2629/// 'cancelSearch' to end this search session.
2630
2631#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2632#[serde(rename_all = "camelCase")]
2633pub struct PerformSearchReturns<'a> {
2634    /// Unique search session identifier.
2635    #[serde(rename = "searchId")]
2636    search_id: Cow<'a, str>,
2637    /// Number of search results.
2638    #[serde(rename = "resultCount")]
2639    result_count: u64,
2640}
2641
2642impl<'a> PerformSearchReturns<'a> {
2643    /// Creates a builder for this type with the required parameters:
2644    /// * `search_id`: Unique search session identifier.
2645    /// * `result_count`: Number of search results.
2646    pub fn builder(search_id: impl Into<Cow<'a, str>>, result_count: u64) -> PerformSearchReturnsBuilder<'a> {
2647        PerformSearchReturnsBuilder {
2648            search_id: search_id.into(),
2649            result_count: result_count,
2650        }
2651    }
2652    /// Unique search session identifier.
2653    pub fn search_id(&self) -> &str { self.search_id.as_ref() }
2654    /// Number of search results.
2655    pub fn result_count(&self) -> u64 { self.result_count }
2656}
2657
2658
2659pub struct PerformSearchReturnsBuilder<'a> {
2660    search_id: Cow<'a, str>,
2661    result_count: u64,
2662}
2663
2664impl<'a> PerformSearchReturnsBuilder<'a> {
2665    pub fn build(self) -> PerformSearchReturns<'a> {
2666        PerformSearchReturns {
2667            search_id: self.search_id,
2668            result_count: self.result_count,
2669        }
2670    }
2671}
2672
2673impl<'a> PerformSearchParams<'a> { pub const METHOD: &'static str = "DOM.performSearch"; }
2674
2675impl<'a> crate::CdpCommand<'a> for PerformSearchParams<'a> {
2676    const METHOD: &'static str = "DOM.performSearch";
2677    type Response = PerformSearchReturns<'a>;
2678}
2679
2680/// Requests that the node is sent to the caller given its path. // FIXME, use XPath
2681
2682#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2683#[serde(rename_all = "camelCase")]
2684pub struct PushNodeByPathToFrontendParams<'a> {
2685    /// Path to node in the proprietary format.
2686    path: Cow<'a, str>,
2687}
2688
2689impl<'a> PushNodeByPathToFrontendParams<'a> {
2690    /// Creates a builder for this type with the required parameters:
2691    /// * `path`: Path to node in the proprietary format.
2692    pub fn builder(path: impl Into<Cow<'a, str>>) -> PushNodeByPathToFrontendParamsBuilder<'a> {
2693        PushNodeByPathToFrontendParamsBuilder {
2694            path: path.into(),
2695        }
2696    }
2697    /// Path to node in the proprietary format.
2698    pub fn path(&self) -> &str { self.path.as_ref() }
2699}
2700
2701
2702pub struct PushNodeByPathToFrontendParamsBuilder<'a> {
2703    path: Cow<'a, str>,
2704}
2705
2706impl<'a> PushNodeByPathToFrontendParamsBuilder<'a> {
2707    pub fn build(self) -> PushNodeByPathToFrontendParams<'a> {
2708        PushNodeByPathToFrontendParams {
2709            path: self.path,
2710        }
2711    }
2712}
2713
2714/// Requests that the node is sent to the caller given its path. // FIXME, use XPath
2715
2716#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2717#[serde(rename_all = "camelCase")]
2718pub struct PushNodeByPathToFrontendReturns {
2719    /// Id of the node for given path.
2720    #[serde(rename = "nodeId")]
2721    node_id: NodeId,
2722}
2723
2724impl PushNodeByPathToFrontendReturns {
2725    /// Creates a builder for this type with the required parameters:
2726    /// * `node_id`: Id of the node for given path.
2727    pub fn builder(node_id: NodeId) -> PushNodeByPathToFrontendReturnsBuilder {
2728        PushNodeByPathToFrontendReturnsBuilder {
2729            node_id: node_id,
2730        }
2731    }
2732    /// Id of the node for given path.
2733    pub fn node_id(&self) -> &NodeId { &self.node_id }
2734}
2735
2736
2737pub struct PushNodeByPathToFrontendReturnsBuilder {
2738    node_id: NodeId,
2739}
2740
2741impl PushNodeByPathToFrontendReturnsBuilder {
2742    pub fn build(self) -> PushNodeByPathToFrontendReturns {
2743        PushNodeByPathToFrontendReturns {
2744            node_id: self.node_id,
2745        }
2746    }
2747}
2748
2749impl<'a> PushNodeByPathToFrontendParams<'a> { pub const METHOD: &'static str = "DOM.pushNodeByPathToFrontend"; }
2750
2751impl<'a> crate::CdpCommand<'a> for PushNodeByPathToFrontendParams<'a> {
2752    const METHOD: &'static str = "DOM.pushNodeByPathToFrontend";
2753    type Response = PushNodeByPathToFrontendReturns;
2754}
2755
2756/// Requests that a batch of nodes is sent to the caller given their backend node ids.
2757
2758#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2759#[serde(rename_all = "camelCase")]
2760pub struct PushNodesByBackendIdsToFrontendParams {
2761    /// The array of backend node ids.
2762    #[serde(rename = "backendNodeIds")]
2763    backend_node_ids: Vec<BackendNodeId>,
2764}
2765
2766impl PushNodesByBackendIdsToFrontendParams {
2767    /// Creates a builder for this type with the required parameters:
2768    /// * `backend_node_ids`: The array of backend node ids.
2769    pub fn builder(backend_node_ids: Vec<BackendNodeId>) -> PushNodesByBackendIdsToFrontendParamsBuilder {
2770        PushNodesByBackendIdsToFrontendParamsBuilder {
2771            backend_node_ids: backend_node_ids,
2772        }
2773    }
2774    /// The array of backend node ids.
2775    pub fn backend_node_ids(&self) -> &[BackendNodeId] { &self.backend_node_ids }
2776}
2777
2778
2779pub struct PushNodesByBackendIdsToFrontendParamsBuilder {
2780    backend_node_ids: Vec<BackendNodeId>,
2781}
2782
2783impl PushNodesByBackendIdsToFrontendParamsBuilder {
2784    pub fn build(self) -> PushNodesByBackendIdsToFrontendParams {
2785        PushNodesByBackendIdsToFrontendParams {
2786            backend_node_ids: self.backend_node_ids,
2787        }
2788    }
2789}
2790
2791/// Requests that a batch of nodes is sent to the caller given their backend node ids.
2792
2793#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2794#[serde(rename_all = "camelCase")]
2795pub struct PushNodesByBackendIdsToFrontendReturns {
2796    /// The array of ids of pushed nodes that correspond to the backend ids specified in
2797    /// backendNodeIds.
2798    #[serde(rename = "nodeIds")]
2799    node_ids: Vec<NodeId>,
2800}
2801
2802impl PushNodesByBackendIdsToFrontendReturns {
2803    /// Creates a builder for this type with the required parameters:
2804    /// * `node_ids`: The array of ids of pushed nodes that correspond to the backend ids specified in backendNodeIds.
2805    pub fn builder(node_ids: Vec<NodeId>) -> PushNodesByBackendIdsToFrontendReturnsBuilder {
2806        PushNodesByBackendIdsToFrontendReturnsBuilder {
2807            node_ids: node_ids,
2808        }
2809    }
2810    /// The array of ids of pushed nodes that correspond to the backend ids specified in
2811    /// backendNodeIds.
2812    pub fn node_ids(&self) -> &[NodeId] { &self.node_ids }
2813}
2814
2815
2816pub struct PushNodesByBackendIdsToFrontendReturnsBuilder {
2817    node_ids: Vec<NodeId>,
2818}
2819
2820impl PushNodesByBackendIdsToFrontendReturnsBuilder {
2821    pub fn build(self) -> PushNodesByBackendIdsToFrontendReturns {
2822        PushNodesByBackendIdsToFrontendReturns {
2823            node_ids: self.node_ids,
2824        }
2825    }
2826}
2827
2828impl PushNodesByBackendIdsToFrontendParams { pub const METHOD: &'static str = "DOM.pushNodesByBackendIdsToFrontend"; }
2829
2830impl<'a> crate::CdpCommand<'a> for PushNodesByBackendIdsToFrontendParams {
2831    const METHOD: &'static str = "DOM.pushNodesByBackendIdsToFrontend";
2832    type Response = PushNodesByBackendIdsToFrontendReturns;
2833}
2834
2835/// Executes 'querySelector' on a given node.
2836
2837#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2838#[serde(rename_all = "camelCase")]
2839pub struct QuerySelectorParams<'a> {
2840    /// Id of the node to query upon.
2841    #[serde(rename = "nodeId")]
2842    node_id: NodeId,
2843    /// Selector string.
2844    selector: Cow<'a, str>,
2845}
2846
2847impl<'a> QuerySelectorParams<'a> {
2848    /// Creates a builder for this type with the required parameters:
2849    /// * `node_id`: Id of the node to query upon.
2850    /// * `selector`: Selector string.
2851    pub fn builder(node_id: NodeId, selector: impl Into<Cow<'a, str>>) -> QuerySelectorParamsBuilder<'a> {
2852        QuerySelectorParamsBuilder {
2853            node_id: node_id,
2854            selector: selector.into(),
2855        }
2856    }
2857    /// Id of the node to query upon.
2858    pub fn node_id(&self) -> &NodeId { &self.node_id }
2859    /// Selector string.
2860    pub fn selector(&self) -> &str { self.selector.as_ref() }
2861}
2862
2863
2864pub struct QuerySelectorParamsBuilder<'a> {
2865    node_id: NodeId,
2866    selector: Cow<'a, str>,
2867}
2868
2869impl<'a> QuerySelectorParamsBuilder<'a> {
2870    pub fn build(self) -> QuerySelectorParams<'a> {
2871        QuerySelectorParams {
2872            node_id: self.node_id,
2873            selector: self.selector,
2874        }
2875    }
2876}
2877
2878/// Executes 'querySelector' on a given node.
2879
2880#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2881#[serde(rename_all = "camelCase")]
2882pub struct QuerySelectorReturns {
2883    /// Query selector result.
2884    #[serde(rename = "nodeId")]
2885    node_id: NodeId,
2886}
2887
2888impl QuerySelectorReturns {
2889    /// Creates a builder for this type with the required parameters:
2890    /// * `node_id`: Query selector result.
2891    pub fn builder(node_id: NodeId) -> QuerySelectorReturnsBuilder {
2892        QuerySelectorReturnsBuilder {
2893            node_id: node_id,
2894        }
2895    }
2896    /// Query selector result.
2897    pub fn node_id(&self) -> &NodeId { &self.node_id }
2898}
2899
2900
2901pub struct QuerySelectorReturnsBuilder {
2902    node_id: NodeId,
2903}
2904
2905impl QuerySelectorReturnsBuilder {
2906    pub fn build(self) -> QuerySelectorReturns {
2907        QuerySelectorReturns {
2908            node_id: self.node_id,
2909        }
2910    }
2911}
2912
2913impl<'a> QuerySelectorParams<'a> { pub const METHOD: &'static str = "DOM.querySelector"; }
2914
2915impl<'a> crate::CdpCommand<'a> for QuerySelectorParams<'a> {
2916    const METHOD: &'static str = "DOM.querySelector";
2917    type Response = QuerySelectorReturns;
2918}
2919
2920/// Executes 'querySelectorAll' on a given node.
2921
2922#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2923#[serde(rename_all = "camelCase")]
2924pub struct QuerySelectorAllParams<'a> {
2925    /// Id of the node to query upon.
2926    #[serde(rename = "nodeId")]
2927    node_id: NodeId,
2928    /// Selector string.
2929    selector: Cow<'a, str>,
2930}
2931
2932impl<'a> QuerySelectorAllParams<'a> {
2933    /// Creates a builder for this type with the required parameters:
2934    /// * `node_id`: Id of the node to query upon.
2935    /// * `selector`: Selector string.
2936    pub fn builder(node_id: NodeId, selector: impl Into<Cow<'a, str>>) -> QuerySelectorAllParamsBuilder<'a> {
2937        QuerySelectorAllParamsBuilder {
2938            node_id: node_id,
2939            selector: selector.into(),
2940        }
2941    }
2942    /// Id of the node to query upon.
2943    pub fn node_id(&self) -> &NodeId { &self.node_id }
2944    /// Selector string.
2945    pub fn selector(&self) -> &str { self.selector.as_ref() }
2946}
2947
2948
2949pub struct QuerySelectorAllParamsBuilder<'a> {
2950    node_id: NodeId,
2951    selector: Cow<'a, str>,
2952}
2953
2954impl<'a> QuerySelectorAllParamsBuilder<'a> {
2955    pub fn build(self) -> QuerySelectorAllParams<'a> {
2956        QuerySelectorAllParams {
2957            node_id: self.node_id,
2958            selector: self.selector,
2959        }
2960    }
2961}
2962
2963/// Executes 'querySelectorAll' on a given node.
2964
2965#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2966#[serde(rename_all = "camelCase")]
2967pub struct QuerySelectorAllReturns {
2968    /// Query selector result.
2969    #[serde(rename = "nodeIds")]
2970    node_ids: Vec<NodeId>,
2971}
2972
2973impl QuerySelectorAllReturns {
2974    /// Creates a builder for this type with the required parameters:
2975    /// * `node_ids`: Query selector result.
2976    pub fn builder(node_ids: Vec<NodeId>) -> QuerySelectorAllReturnsBuilder {
2977        QuerySelectorAllReturnsBuilder {
2978            node_ids: node_ids,
2979        }
2980    }
2981    /// Query selector result.
2982    pub fn node_ids(&self) -> &[NodeId] { &self.node_ids }
2983}
2984
2985
2986pub struct QuerySelectorAllReturnsBuilder {
2987    node_ids: Vec<NodeId>,
2988}
2989
2990impl QuerySelectorAllReturnsBuilder {
2991    pub fn build(self) -> QuerySelectorAllReturns {
2992        QuerySelectorAllReturns {
2993            node_ids: self.node_ids,
2994        }
2995    }
2996}
2997
2998impl<'a> QuerySelectorAllParams<'a> { pub const METHOD: &'static str = "DOM.querySelectorAll"; }
2999
3000impl<'a> crate::CdpCommand<'a> for QuerySelectorAllParams<'a> {
3001    const METHOD: &'static str = "DOM.querySelectorAll";
3002    type Response = QuerySelectorAllReturns;
3003}
3004
3005/// Returns NodeIds of current top layer elements.
3006/// Top layer is rendered closest to the user within a viewport, therefore its elements always
3007/// appear on top of all other content.
3008
3009#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3010#[serde(rename_all = "camelCase")]
3011pub struct GetTopLayerElementsReturns {
3012    /// NodeIds of top layer elements
3013    #[serde(rename = "nodeIds")]
3014    node_ids: Vec<NodeId>,
3015}
3016
3017impl GetTopLayerElementsReturns {
3018    /// Creates a builder for this type with the required parameters:
3019    /// * `node_ids`: NodeIds of top layer elements
3020    pub fn builder(node_ids: Vec<NodeId>) -> GetTopLayerElementsReturnsBuilder {
3021        GetTopLayerElementsReturnsBuilder {
3022            node_ids: node_ids,
3023        }
3024    }
3025    /// NodeIds of top layer elements
3026    pub fn node_ids(&self) -> &[NodeId] { &self.node_ids }
3027}
3028
3029
3030pub struct GetTopLayerElementsReturnsBuilder {
3031    node_ids: Vec<NodeId>,
3032}
3033
3034impl GetTopLayerElementsReturnsBuilder {
3035    pub fn build(self) -> GetTopLayerElementsReturns {
3036        GetTopLayerElementsReturns {
3037            node_ids: self.node_ids,
3038        }
3039    }
3040}
3041
3042#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3043pub struct GetTopLayerElementsParams {}
3044
3045impl GetTopLayerElementsParams { pub const METHOD: &'static str = "DOM.getTopLayerElements"; }
3046
3047impl<'a> crate::CdpCommand<'a> for GetTopLayerElementsParams {
3048    const METHOD: &'static str = "DOM.getTopLayerElements";
3049    type Response = GetTopLayerElementsReturns;
3050}
3051
3052/// Returns the NodeId of the matched element according to certain relations.
3053
3054#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3055#[serde(rename_all = "camelCase")]
3056pub struct GetElementByRelationParams<'a> {
3057    /// Id of the node from which to query the relation.
3058    #[serde(rename = "nodeId")]
3059    node_id: NodeId,
3060    /// Type of relation to get.
3061    relation: Cow<'a, str>,
3062}
3063
3064impl<'a> GetElementByRelationParams<'a> {
3065    /// Creates a builder for this type with the required parameters:
3066    /// * `node_id`: Id of the node from which to query the relation.
3067    /// * `relation`: Type of relation to get.
3068    pub fn builder(node_id: NodeId, relation: impl Into<Cow<'a, str>>) -> GetElementByRelationParamsBuilder<'a> {
3069        GetElementByRelationParamsBuilder {
3070            node_id: node_id,
3071            relation: relation.into(),
3072        }
3073    }
3074    /// Id of the node from which to query the relation.
3075    pub fn node_id(&self) -> &NodeId { &self.node_id }
3076    /// Type of relation to get.
3077    pub fn relation(&self) -> &str { self.relation.as_ref() }
3078}
3079
3080
3081pub struct GetElementByRelationParamsBuilder<'a> {
3082    node_id: NodeId,
3083    relation: Cow<'a, str>,
3084}
3085
3086impl<'a> GetElementByRelationParamsBuilder<'a> {
3087    pub fn build(self) -> GetElementByRelationParams<'a> {
3088        GetElementByRelationParams {
3089            node_id: self.node_id,
3090            relation: self.relation,
3091        }
3092    }
3093}
3094
3095/// Returns the NodeId of the matched element according to certain relations.
3096
3097#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3098#[serde(rename_all = "camelCase")]
3099pub struct GetElementByRelationReturns {
3100    /// NodeId of the element matching the queried relation.
3101    #[serde(rename = "nodeId")]
3102    node_id: NodeId,
3103}
3104
3105impl GetElementByRelationReturns {
3106    /// Creates a builder for this type with the required parameters:
3107    /// * `node_id`: NodeId of the element matching the queried relation.
3108    pub fn builder(node_id: NodeId) -> GetElementByRelationReturnsBuilder {
3109        GetElementByRelationReturnsBuilder {
3110            node_id: node_id,
3111        }
3112    }
3113    /// NodeId of the element matching the queried relation.
3114    pub fn node_id(&self) -> &NodeId { &self.node_id }
3115}
3116
3117
3118pub struct GetElementByRelationReturnsBuilder {
3119    node_id: NodeId,
3120}
3121
3122impl GetElementByRelationReturnsBuilder {
3123    pub fn build(self) -> GetElementByRelationReturns {
3124        GetElementByRelationReturns {
3125            node_id: self.node_id,
3126        }
3127    }
3128}
3129
3130impl<'a> GetElementByRelationParams<'a> { pub const METHOD: &'static str = "DOM.getElementByRelation"; }
3131
3132impl<'a> crate::CdpCommand<'a> for GetElementByRelationParams<'a> {
3133    const METHOD: &'static str = "DOM.getElementByRelation";
3134    type Response = GetElementByRelationReturns;
3135}
3136
3137#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3138pub struct RedoParams {}
3139
3140impl RedoParams { pub const METHOD: &'static str = "DOM.redo"; }
3141
3142impl<'a> crate::CdpCommand<'a> for RedoParams {
3143    const METHOD: &'static str = "DOM.redo";
3144    type Response = crate::EmptyReturns;
3145}
3146
3147/// Removes attribute with given name from an element with given id.
3148
3149#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3150#[serde(rename_all = "camelCase")]
3151pub struct RemoveAttributeParams<'a> {
3152    /// Id of the element to remove attribute from.
3153    #[serde(rename = "nodeId")]
3154    node_id: NodeId,
3155    /// Name of the attribute to remove.
3156    name: Cow<'a, str>,
3157}
3158
3159impl<'a> RemoveAttributeParams<'a> {
3160    /// Creates a builder for this type with the required parameters:
3161    /// * `node_id`: Id of the element to remove attribute from.
3162    /// * `name`: Name of the attribute to remove.
3163    pub fn builder(node_id: NodeId, name: impl Into<Cow<'a, str>>) -> RemoveAttributeParamsBuilder<'a> {
3164        RemoveAttributeParamsBuilder {
3165            node_id: node_id,
3166            name: name.into(),
3167        }
3168    }
3169    /// Id of the element to remove attribute from.
3170    pub fn node_id(&self) -> &NodeId { &self.node_id }
3171    /// Name of the attribute to remove.
3172    pub fn name(&self) -> &str { self.name.as_ref() }
3173}
3174
3175
3176pub struct RemoveAttributeParamsBuilder<'a> {
3177    node_id: NodeId,
3178    name: Cow<'a, str>,
3179}
3180
3181impl<'a> RemoveAttributeParamsBuilder<'a> {
3182    pub fn build(self) -> RemoveAttributeParams<'a> {
3183        RemoveAttributeParams {
3184            node_id: self.node_id,
3185            name: self.name,
3186        }
3187    }
3188}
3189
3190impl<'a> RemoveAttributeParams<'a> { pub const METHOD: &'static str = "DOM.removeAttribute"; }
3191
3192impl<'a> crate::CdpCommand<'a> for RemoveAttributeParams<'a> {
3193    const METHOD: &'static str = "DOM.removeAttribute";
3194    type Response = crate::EmptyReturns;
3195}
3196
3197/// Removes node with given id.
3198
3199#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3200#[serde(rename_all = "camelCase")]
3201pub struct RemoveNodeParams {
3202    /// Id of the node to remove.
3203    #[serde(rename = "nodeId")]
3204    node_id: NodeId,
3205}
3206
3207impl RemoveNodeParams {
3208    /// Creates a builder for this type with the required parameters:
3209    /// * `node_id`: Id of the node to remove.
3210    pub fn builder(node_id: NodeId) -> RemoveNodeParamsBuilder {
3211        RemoveNodeParamsBuilder {
3212            node_id: node_id,
3213        }
3214    }
3215    /// Id of the node to remove.
3216    pub fn node_id(&self) -> &NodeId { &self.node_id }
3217}
3218
3219
3220pub struct RemoveNodeParamsBuilder {
3221    node_id: NodeId,
3222}
3223
3224impl RemoveNodeParamsBuilder {
3225    pub fn build(self) -> RemoveNodeParams {
3226        RemoveNodeParams {
3227            node_id: self.node_id,
3228        }
3229    }
3230}
3231
3232impl RemoveNodeParams { pub const METHOD: &'static str = "DOM.removeNode"; }
3233
3234impl<'a> crate::CdpCommand<'a> for RemoveNodeParams {
3235    const METHOD: &'static str = "DOM.removeNode";
3236    type Response = crate::EmptyReturns;
3237}
3238
3239/// Requests that children of the node with given id are returned to the caller in form of
3240/// 'setChildNodes' events where not only immediate children are retrieved, but all children down to
3241/// the specified depth.
3242
3243#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3244#[serde(rename_all = "camelCase")]
3245pub struct RequestChildNodesParams {
3246    /// Id of the node to get children for.
3247    #[serde(rename = "nodeId")]
3248    node_id: NodeId,
3249    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
3250    /// entire subtree or provide an integer larger than 0.
3251    #[serde(skip_serializing_if = "Option::is_none")]
3252    depth: Option<i64>,
3253    /// Whether or not iframes and shadow roots should be traversed when returning the sub-tree
3254    /// (default is false).
3255    #[serde(skip_serializing_if = "Option::is_none")]
3256    pierce: Option<bool>,
3257}
3258
3259impl RequestChildNodesParams {
3260    /// Creates a builder for this type with the required parameters:
3261    /// * `node_id`: Id of the node to get children for.
3262    pub fn builder(node_id: NodeId) -> RequestChildNodesParamsBuilder {
3263        RequestChildNodesParamsBuilder {
3264            node_id: node_id,
3265            depth: None,
3266            pierce: None,
3267        }
3268    }
3269    /// Id of the node to get children for.
3270    pub fn node_id(&self) -> &NodeId { &self.node_id }
3271    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
3272    /// entire subtree or provide an integer larger than 0.
3273    pub fn depth(&self) -> Option<i64> { self.depth }
3274    /// Whether or not iframes and shadow roots should be traversed when returning the sub-tree
3275    /// (default is false).
3276    pub fn pierce(&self) -> Option<bool> { self.pierce }
3277}
3278
3279
3280pub struct RequestChildNodesParamsBuilder {
3281    node_id: NodeId,
3282    depth: Option<i64>,
3283    pierce: Option<bool>,
3284}
3285
3286impl RequestChildNodesParamsBuilder {
3287    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
3288    /// entire subtree or provide an integer larger than 0.
3289    pub fn depth(mut self, depth: i64) -> Self { self.depth = Some(depth); self }
3290    /// Whether or not iframes and shadow roots should be traversed when returning the sub-tree
3291    /// (default is false).
3292    pub fn pierce(mut self, pierce: bool) -> Self { self.pierce = Some(pierce); self }
3293    pub fn build(self) -> RequestChildNodesParams {
3294        RequestChildNodesParams {
3295            node_id: self.node_id,
3296            depth: self.depth,
3297            pierce: self.pierce,
3298        }
3299    }
3300}
3301
3302impl RequestChildNodesParams { pub const METHOD: &'static str = "DOM.requestChildNodes"; }
3303
3304impl<'a> crate::CdpCommand<'a> for RequestChildNodesParams {
3305    const METHOD: &'static str = "DOM.requestChildNodes";
3306    type Response = crate::EmptyReturns;
3307}
3308
3309/// Requests that the node is sent to the caller given the JavaScript node object reference. All
3310/// nodes that form the path from the node to the root are also sent to the client as a series of
3311/// 'setChildNodes' notifications.
3312
3313#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3314#[serde(rename_all = "camelCase")]
3315pub struct RequestNodeParams<'a> {
3316    /// JavaScript object id to convert into node.
3317    #[serde(rename = "objectId")]
3318    object_id: crate::runtime::RemoteObjectId<'a>,
3319}
3320
3321impl<'a> RequestNodeParams<'a> {
3322    /// Creates a builder for this type with the required parameters:
3323    /// * `object_id`: JavaScript object id to convert into node.
3324    pub fn builder(object_id: crate::runtime::RemoteObjectId<'a>) -> RequestNodeParamsBuilder<'a> {
3325        RequestNodeParamsBuilder {
3326            object_id: object_id,
3327        }
3328    }
3329    /// JavaScript object id to convert into node.
3330    pub fn object_id(&self) -> &crate::runtime::RemoteObjectId<'a> { &self.object_id }
3331}
3332
3333
3334pub struct RequestNodeParamsBuilder<'a> {
3335    object_id: crate::runtime::RemoteObjectId<'a>,
3336}
3337
3338impl<'a> RequestNodeParamsBuilder<'a> {
3339    pub fn build(self) -> RequestNodeParams<'a> {
3340        RequestNodeParams {
3341            object_id: self.object_id,
3342        }
3343    }
3344}
3345
3346/// Requests that the node is sent to the caller given the JavaScript node object reference. All
3347/// nodes that form the path from the node to the root are also sent to the client as a series of
3348/// 'setChildNodes' notifications.
3349
3350#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3351#[serde(rename_all = "camelCase")]
3352pub struct RequestNodeReturns {
3353    /// Node id for given object.
3354    #[serde(rename = "nodeId")]
3355    node_id: NodeId,
3356}
3357
3358impl RequestNodeReturns {
3359    /// Creates a builder for this type with the required parameters:
3360    /// * `node_id`: Node id for given object.
3361    pub fn builder(node_id: NodeId) -> RequestNodeReturnsBuilder {
3362        RequestNodeReturnsBuilder {
3363            node_id: node_id,
3364        }
3365    }
3366    /// Node id for given object.
3367    pub fn node_id(&self) -> &NodeId { &self.node_id }
3368}
3369
3370
3371pub struct RequestNodeReturnsBuilder {
3372    node_id: NodeId,
3373}
3374
3375impl RequestNodeReturnsBuilder {
3376    pub fn build(self) -> RequestNodeReturns {
3377        RequestNodeReturns {
3378            node_id: self.node_id,
3379        }
3380    }
3381}
3382
3383impl<'a> RequestNodeParams<'a> { pub const METHOD: &'static str = "DOM.requestNode"; }
3384
3385impl<'a> crate::CdpCommand<'a> for RequestNodeParams<'a> {
3386    const METHOD: &'static str = "DOM.requestNode";
3387    type Response = RequestNodeReturns;
3388}
3389
3390/// Resolves the JavaScript node object for a given NodeId or BackendNodeId.
3391
3392#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3393#[serde(rename_all = "camelCase")]
3394pub struct ResolveNodeParams<'a> {
3395    /// Id of the node to resolve.
3396    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
3397    node_id: Option<NodeId>,
3398    /// Backend identifier of the node to resolve.
3399    #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
3400    backend_node_id: Option<crate::dom::BackendNodeId>,
3401    /// Symbolic group name that can be used to release multiple objects.
3402    #[serde(skip_serializing_if = "Option::is_none", rename = "objectGroup")]
3403    object_group: Option<Cow<'a, str>>,
3404    /// Execution context in which to resolve the node.
3405    #[serde(skip_serializing_if = "Option::is_none", rename = "executionContextId")]
3406    execution_context_id: Option<crate::runtime::ExecutionContextId>,
3407}
3408
3409impl<'a> ResolveNodeParams<'a> {
3410    /// Creates a builder for this type.
3411    pub fn builder() -> ResolveNodeParamsBuilder<'a> {
3412        ResolveNodeParamsBuilder {
3413            node_id: None,
3414            backend_node_id: None,
3415            object_group: None,
3416            execution_context_id: None,
3417        }
3418    }
3419    /// Id of the node to resolve.
3420    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
3421    /// Backend identifier of the node to resolve.
3422    pub fn backend_node_id(&self) -> Option<&crate::dom::BackendNodeId> { self.backend_node_id.as_ref() }
3423    /// Symbolic group name that can be used to release multiple objects.
3424    pub fn object_group(&self) -> Option<&str> { self.object_group.as_deref() }
3425    /// Execution context in which to resolve the node.
3426    pub fn execution_context_id(&self) -> Option<&crate::runtime::ExecutionContextId> { self.execution_context_id.as_ref() }
3427}
3428
3429#[derive(Default)]
3430pub struct ResolveNodeParamsBuilder<'a> {
3431    node_id: Option<NodeId>,
3432    backend_node_id: Option<crate::dom::BackendNodeId>,
3433    object_group: Option<Cow<'a, str>>,
3434    execution_context_id: Option<crate::runtime::ExecutionContextId>,
3435}
3436
3437impl<'a> ResolveNodeParamsBuilder<'a> {
3438    /// Id of the node to resolve.
3439    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
3440    /// Backend identifier of the node to resolve.
3441    pub fn backend_node_id(mut self, backend_node_id: crate::dom::BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
3442    /// Symbolic group name that can be used to release multiple objects.
3443    pub fn object_group(mut self, object_group: impl Into<Cow<'a, str>>) -> Self { self.object_group = Some(object_group.into()); self }
3444    /// Execution context in which to resolve the node.
3445    pub fn execution_context_id(mut self, execution_context_id: crate::runtime::ExecutionContextId) -> Self { self.execution_context_id = Some(execution_context_id); self }
3446    pub fn build(self) -> ResolveNodeParams<'a> {
3447        ResolveNodeParams {
3448            node_id: self.node_id,
3449            backend_node_id: self.backend_node_id,
3450            object_group: self.object_group,
3451            execution_context_id: self.execution_context_id,
3452        }
3453    }
3454}
3455
3456/// Resolves the JavaScript node object for a given NodeId or BackendNodeId.
3457
3458#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3459#[serde(rename_all = "camelCase")]
3460pub struct ResolveNodeReturns {
3461    /// JavaScript object wrapper for given node.
3462    object: crate::runtime::RemoteObject,
3463}
3464
3465impl ResolveNodeReturns {
3466    /// Creates a builder for this type with the required parameters:
3467    /// * `object`: JavaScript object wrapper for given node.
3468    pub fn builder(object: crate::runtime::RemoteObject) -> ResolveNodeReturnsBuilder {
3469        ResolveNodeReturnsBuilder {
3470            object: object,
3471        }
3472    }
3473    /// JavaScript object wrapper for given node.
3474    pub fn object(&self) -> &crate::runtime::RemoteObject { &self.object }
3475}
3476
3477
3478pub struct ResolveNodeReturnsBuilder {
3479    object: crate::runtime::RemoteObject,
3480}
3481
3482impl ResolveNodeReturnsBuilder {
3483    pub fn build(self) -> ResolveNodeReturns {
3484        ResolveNodeReturns {
3485            object: self.object,
3486        }
3487    }
3488}
3489
3490impl<'a> ResolveNodeParams<'a> { pub const METHOD: &'static str = "DOM.resolveNode"; }
3491
3492impl<'a> crate::CdpCommand<'a> for ResolveNodeParams<'a> {
3493    const METHOD: &'static str = "DOM.resolveNode";
3494    type Response = ResolveNodeReturns;
3495}
3496
3497/// Sets attribute for an element with given id.
3498
3499#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3500#[serde(rename_all = "camelCase")]
3501pub struct SetAttributeValueParams<'a> {
3502    /// Id of the element to set attribute for.
3503    #[serde(rename = "nodeId")]
3504    node_id: NodeId,
3505    /// Attribute name.
3506    name: Cow<'a, str>,
3507    /// Attribute value.
3508    value: Cow<'a, str>,
3509}
3510
3511impl<'a> SetAttributeValueParams<'a> {
3512    /// Creates a builder for this type with the required parameters:
3513    /// * `node_id`: Id of the element to set attribute for.
3514    /// * `name`: Attribute name.
3515    /// * `value`: Attribute value.
3516    pub fn builder(node_id: NodeId, name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> SetAttributeValueParamsBuilder<'a> {
3517        SetAttributeValueParamsBuilder {
3518            node_id: node_id,
3519            name: name.into(),
3520            value: value.into(),
3521        }
3522    }
3523    /// Id of the element to set attribute for.
3524    pub fn node_id(&self) -> &NodeId { &self.node_id }
3525    /// Attribute name.
3526    pub fn name(&self) -> &str { self.name.as_ref() }
3527    /// Attribute value.
3528    pub fn value(&self) -> &str { self.value.as_ref() }
3529}
3530
3531
3532pub struct SetAttributeValueParamsBuilder<'a> {
3533    node_id: NodeId,
3534    name: Cow<'a, str>,
3535    value: Cow<'a, str>,
3536}
3537
3538impl<'a> SetAttributeValueParamsBuilder<'a> {
3539    pub fn build(self) -> SetAttributeValueParams<'a> {
3540        SetAttributeValueParams {
3541            node_id: self.node_id,
3542            name: self.name,
3543            value: self.value,
3544        }
3545    }
3546}
3547
3548impl<'a> SetAttributeValueParams<'a> { pub const METHOD: &'static str = "DOM.setAttributeValue"; }
3549
3550impl<'a> crate::CdpCommand<'a> for SetAttributeValueParams<'a> {
3551    const METHOD: &'static str = "DOM.setAttributeValue";
3552    type Response = crate::EmptyReturns;
3553}
3554
3555/// Sets attributes on element with given id. This method is useful when user edits some existing
3556/// attribute value and types in several attribute name/value pairs.
3557
3558#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3559#[serde(rename_all = "camelCase")]
3560pub struct SetAttributesAsTextParams<'a> {
3561    /// Id of the element to set attributes for.
3562    #[serde(rename = "nodeId")]
3563    node_id: NodeId,
3564    /// Text with a number of attributes. Will parse this text using HTML parser.
3565    text: Cow<'a, str>,
3566    /// Attribute name to replace with new attributes derived from text in case text parsed
3567    /// successfully.
3568    #[serde(skip_serializing_if = "Option::is_none")]
3569    name: Option<Cow<'a, str>>,
3570}
3571
3572impl<'a> SetAttributesAsTextParams<'a> {
3573    /// Creates a builder for this type with the required parameters:
3574    /// * `node_id`: Id of the element to set attributes for.
3575    /// * `text`: Text with a number of attributes. Will parse this text using HTML parser.
3576    pub fn builder(node_id: NodeId, text: impl Into<Cow<'a, str>>) -> SetAttributesAsTextParamsBuilder<'a> {
3577        SetAttributesAsTextParamsBuilder {
3578            node_id: node_id,
3579            text: text.into(),
3580            name: None,
3581        }
3582    }
3583    /// Id of the element to set attributes for.
3584    pub fn node_id(&self) -> &NodeId { &self.node_id }
3585    /// Text with a number of attributes. Will parse this text using HTML parser.
3586    pub fn text(&self) -> &str { self.text.as_ref() }
3587    /// Attribute name to replace with new attributes derived from text in case text parsed
3588    /// successfully.
3589    pub fn name(&self) -> Option<&str> { self.name.as_deref() }
3590}
3591
3592
3593pub struct SetAttributesAsTextParamsBuilder<'a> {
3594    node_id: NodeId,
3595    text: Cow<'a, str>,
3596    name: Option<Cow<'a, str>>,
3597}
3598
3599impl<'a> SetAttributesAsTextParamsBuilder<'a> {
3600    /// Attribute name to replace with new attributes derived from text in case text parsed
3601    /// successfully.
3602    pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
3603    pub fn build(self) -> SetAttributesAsTextParams<'a> {
3604        SetAttributesAsTextParams {
3605            node_id: self.node_id,
3606            text: self.text,
3607            name: self.name,
3608        }
3609    }
3610}
3611
3612impl<'a> SetAttributesAsTextParams<'a> { pub const METHOD: &'static str = "DOM.setAttributesAsText"; }
3613
3614impl<'a> crate::CdpCommand<'a> for SetAttributesAsTextParams<'a> {
3615    const METHOD: &'static str = "DOM.setAttributesAsText";
3616    type Response = crate::EmptyReturns;
3617}
3618
3619/// Sets files for the given file input element.
3620
3621#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3622#[serde(rename_all = "camelCase")]
3623pub struct SetFileInputFilesParams<'a> {
3624    /// Array of file paths to set.
3625    files: Vec<Cow<'a, str>>,
3626    /// Identifier of the node.
3627    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
3628    node_id: Option<NodeId>,
3629    /// Identifier of the backend node.
3630    #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
3631    backend_node_id: Option<BackendNodeId>,
3632    /// JavaScript object id of the node wrapper.
3633    #[serde(skip_serializing_if = "Option::is_none", rename = "objectId")]
3634    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
3635}
3636
3637impl<'a> SetFileInputFilesParams<'a> {
3638    /// Creates a builder for this type with the required parameters:
3639    /// * `files`: Array of file paths to set.
3640    pub fn builder(files: Vec<Cow<'a, str>>) -> SetFileInputFilesParamsBuilder<'a> {
3641        SetFileInputFilesParamsBuilder {
3642            files: files,
3643            node_id: None,
3644            backend_node_id: None,
3645            object_id: None,
3646        }
3647    }
3648    /// Array of file paths to set.
3649    pub fn files(&self) -> &[Cow<'a, str>] { &self.files }
3650    /// Identifier of the node.
3651    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
3652    /// Identifier of the backend node.
3653    pub fn backend_node_id(&self) -> Option<&BackendNodeId> { self.backend_node_id.as_ref() }
3654    /// JavaScript object id of the node wrapper.
3655    pub fn object_id(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.object_id.as_ref() }
3656}
3657
3658
3659pub struct SetFileInputFilesParamsBuilder<'a> {
3660    files: Vec<Cow<'a, str>>,
3661    node_id: Option<NodeId>,
3662    backend_node_id: Option<BackendNodeId>,
3663    object_id: Option<crate::runtime::RemoteObjectId<'a>>,
3664}
3665
3666impl<'a> SetFileInputFilesParamsBuilder<'a> {
3667    /// Identifier of the node.
3668    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
3669    /// Identifier of the backend node.
3670    pub fn backend_node_id(mut self, backend_node_id: BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
3671    /// JavaScript object id of the node wrapper.
3672    pub fn object_id(mut self, object_id: crate::runtime::RemoteObjectId<'a>) -> Self { self.object_id = Some(object_id); self }
3673    pub fn build(self) -> SetFileInputFilesParams<'a> {
3674        SetFileInputFilesParams {
3675            files: self.files,
3676            node_id: self.node_id,
3677            backend_node_id: self.backend_node_id,
3678            object_id: self.object_id,
3679        }
3680    }
3681}
3682
3683impl<'a> SetFileInputFilesParams<'a> { pub const METHOD: &'static str = "DOM.setFileInputFiles"; }
3684
3685impl<'a> crate::CdpCommand<'a> for SetFileInputFilesParams<'a> {
3686    const METHOD: &'static str = "DOM.setFileInputFiles";
3687    type Response = crate::EmptyReturns;
3688}
3689
3690/// Sets if stack traces should be captured for Nodes. See 'Node.getNodeStackTraces'. Default is disabled.
3691
3692#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3693#[serde(rename_all = "camelCase")]
3694pub struct SetNodeStackTracesEnabledParams {
3695    /// Enable or disable.
3696    enable: bool,
3697}
3698
3699impl SetNodeStackTracesEnabledParams {
3700    /// Creates a builder for this type with the required parameters:
3701    /// * `enable`: Enable or disable.
3702    pub fn builder(enable: bool) -> SetNodeStackTracesEnabledParamsBuilder {
3703        SetNodeStackTracesEnabledParamsBuilder {
3704            enable: enable,
3705        }
3706    }
3707    /// Enable or disable.
3708    pub fn enable(&self) -> bool { self.enable }
3709}
3710
3711
3712pub struct SetNodeStackTracesEnabledParamsBuilder {
3713    enable: bool,
3714}
3715
3716impl SetNodeStackTracesEnabledParamsBuilder {
3717    pub fn build(self) -> SetNodeStackTracesEnabledParams {
3718        SetNodeStackTracesEnabledParams {
3719            enable: self.enable,
3720        }
3721    }
3722}
3723
3724impl SetNodeStackTracesEnabledParams { pub const METHOD: &'static str = "DOM.setNodeStackTracesEnabled"; }
3725
3726impl<'a> crate::CdpCommand<'a> for SetNodeStackTracesEnabledParams {
3727    const METHOD: &'static str = "DOM.setNodeStackTracesEnabled";
3728    type Response = crate::EmptyReturns;
3729}
3730
3731/// Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.
3732
3733#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3734#[serde(rename_all = "camelCase")]
3735pub struct GetNodeStackTracesParams {
3736    /// Id of the node to get stack traces for.
3737    #[serde(rename = "nodeId")]
3738    node_id: NodeId,
3739}
3740
3741impl GetNodeStackTracesParams {
3742    /// Creates a builder for this type with the required parameters:
3743    /// * `node_id`: Id of the node to get stack traces for.
3744    pub fn builder(node_id: NodeId) -> GetNodeStackTracesParamsBuilder {
3745        GetNodeStackTracesParamsBuilder {
3746            node_id: node_id,
3747        }
3748    }
3749    /// Id of the node to get stack traces for.
3750    pub fn node_id(&self) -> &NodeId { &self.node_id }
3751}
3752
3753
3754pub struct GetNodeStackTracesParamsBuilder {
3755    node_id: NodeId,
3756}
3757
3758impl GetNodeStackTracesParamsBuilder {
3759    pub fn build(self) -> GetNodeStackTracesParams {
3760        GetNodeStackTracesParams {
3761            node_id: self.node_id,
3762        }
3763    }
3764}
3765
3766/// Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.
3767
3768#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3769#[serde(rename_all = "camelCase")]
3770pub struct GetNodeStackTracesReturns {
3771    /// Creation stack trace, if available.
3772    #[serde(skip_serializing_if = "Option::is_none")]
3773    creation: Option<crate::runtime::StackTrace>,
3774}
3775
3776impl GetNodeStackTracesReturns {
3777    /// Creates a builder for this type.
3778    pub fn builder() -> GetNodeStackTracesReturnsBuilder {
3779        GetNodeStackTracesReturnsBuilder {
3780            creation: None,
3781        }
3782    }
3783    /// Creation stack trace, if available.
3784    pub fn creation(&self) -> Option<&crate::runtime::StackTrace> { self.creation.as_ref() }
3785}
3786
3787#[derive(Default)]
3788pub struct GetNodeStackTracesReturnsBuilder {
3789    creation: Option<crate::runtime::StackTrace>,
3790}
3791
3792impl GetNodeStackTracesReturnsBuilder {
3793    /// Creation stack trace, if available.
3794    pub fn creation(mut self, creation: crate::runtime::StackTrace) -> Self { self.creation = Some(creation); self }
3795    pub fn build(self) -> GetNodeStackTracesReturns {
3796        GetNodeStackTracesReturns {
3797            creation: self.creation,
3798        }
3799    }
3800}
3801
3802impl GetNodeStackTracesParams { pub const METHOD: &'static str = "DOM.getNodeStackTraces"; }
3803
3804impl<'a> crate::CdpCommand<'a> for GetNodeStackTracesParams {
3805    const METHOD: &'static str = "DOM.getNodeStackTraces";
3806    type Response = GetNodeStackTracesReturns;
3807}
3808
3809/// Returns file information for the given
3810/// File wrapper.
3811
3812#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3813#[serde(rename_all = "camelCase")]
3814pub struct GetFileInfoParams<'a> {
3815    /// JavaScript object id of the node wrapper.
3816    #[serde(rename = "objectId")]
3817    object_id: crate::runtime::RemoteObjectId<'a>,
3818}
3819
3820impl<'a> GetFileInfoParams<'a> {
3821    /// Creates a builder for this type with the required parameters:
3822    /// * `object_id`: JavaScript object id of the node wrapper.
3823    pub fn builder(object_id: crate::runtime::RemoteObjectId<'a>) -> GetFileInfoParamsBuilder<'a> {
3824        GetFileInfoParamsBuilder {
3825            object_id: object_id,
3826        }
3827    }
3828    /// JavaScript object id of the node wrapper.
3829    pub fn object_id(&self) -> &crate::runtime::RemoteObjectId<'a> { &self.object_id }
3830}
3831
3832
3833pub struct GetFileInfoParamsBuilder<'a> {
3834    object_id: crate::runtime::RemoteObjectId<'a>,
3835}
3836
3837impl<'a> GetFileInfoParamsBuilder<'a> {
3838    pub fn build(self) -> GetFileInfoParams<'a> {
3839        GetFileInfoParams {
3840            object_id: self.object_id,
3841        }
3842    }
3843}
3844
3845/// Returns file information for the given
3846/// File wrapper.
3847
3848#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3849#[serde(rename_all = "camelCase")]
3850pub struct GetFileInfoReturns<'a> {
3851    path: Cow<'a, str>,
3852}
3853
3854impl<'a> GetFileInfoReturns<'a> {
3855    /// Creates a builder for this type with the required parameters:
3856    /// * `path`: 
3857    pub fn builder(path: impl Into<Cow<'a, str>>) -> GetFileInfoReturnsBuilder<'a> {
3858        GetFileInfoReturnsBuilder {
3859            path: path.into(),
3860        }
3861    }
3862    pub fn path(&self) -> &str { self.path.as_ref() }
3863}
3864
3865
3866pub struct GetFileInfoReturnsBuilder<'a> {
3867    path: Cow<'a, str>,
3868}
3869
3870impl<'a> GetFileInfoReturnsBuilder<'a> {
3871    pub fn build(self) -> GetFileInfoReturns<'a> {
3872        GetFileInfoReturns {
3873            path: self.path,
3874        }
3875    }
3876}
3877
3878impl<'a> GetFileInfoParams<'a> { pub const METHOD: &'static str = "DOM.getFileInfo"; }
3879
3880impl<'a> crate::CdpCommand<'a> for GetFileInfoParams<'a> {
3881    const METHOD: &'static str = "DOM.getFileInfo";
3882    type Response = GetFileInfoReturns<'a>;
3883}
3884
3885/// Returns list of detached nodes
3886
3887#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3888#[serde(rename_all = "camelCase")]
3889pub struct GetDetachedDomNodesReturns<'a> {
3890    /// The list of detached nodes
3891    #[serde(rename = "detachedNodes")]
3892    detached_nodes: Vec<DetachedElementInfo<'a>>,
3893}
3894
3895impl<'a> GetDetachedDomNodesReturns<'a> {
3896    /// Creates a builder for this type with the required parameters:
3897    /// * `detached_nodes`: The list of detached nodes
3898    pub fn builder(detached_nodes: Vec<DetachedElementInfo<'a>>) -> GetDetachedDomNodesReturnsBuilder<'a> {
3899        GetDetachedDomNodesReturnsBuilder {
3900            detached_nodes: detached_nodes,
3901        }
3902    }
3903    /// The list of detached nodes
3904    pub fn detached_nodes(&self) -> &[DetachedElementInfo<'a>] { &self.detached_nodes }
3905}
3906
3907
3908pub struct GetDetachedDomNodesReturnsBuilder<'a> {
3909    detached_nodes: Vec<DetachedElementInfo<'a>>,
3910}
3911
3912impl<'a> GetDetachedDomNodesReturnsBuilder<'a> {
3913    pub fn build(self) -> GetDetachedDomNodesReturns<'a> {
3914        GetDetachedDomNodesReturns {
3915            detached_nodes: self.detached_nodes,
3916        }
3917    }
3918}
3919
3920#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3921pub struct GetDetachedDomNodesParams {}
3922
3923impl GetDetachedDomNodesParams { pub const METHOD: &'static str = "DOM.getDetachedDomNodes"; }
3924
3925impl<'a> crate::CdpCommand<'a> for GetDetachedDomNodesParams {
3926    const METHOD: &'static str = "DOM.getDetachedDomNodes";
3927    type Response = GetDetachedDomNodesReturns<'a>;
3928}
3929
3930/// Enables console to refer to the node with given id via $x (see Command Line API for more details
3931/// $x functions).
3932
3933#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3934#[serde(rename_all = "camelCase")]
3935pub struct SetInspectedNodeParams {
3936    /// DOM node id to be accessible by means of $x command line API.
3937    #[serde(rename = "nodeId")]
3938    node_id: NodeId,
3939}
3940
3941impl SetInspectedNodeParams {
3942    /// Creates a builder for this type with the required parameters:
3943    /// * `node_id`: DOM node id to be accessible by means of $x command line API.
3944    pub fn builder(node_id: NodeId) -> SetInspectedNodeParamsBuilder {
3945        SetInspectedNodeParamsBuilder {
3946            node_id: node_id,
3947        }
3948    }
3949    /// DOM node id to be accessible by means of $x command line API.
3950    pub fn node_id(&self) -> &NodeId { &self.node_id }
3951}
3952
3953
3954pub struct SetInspectedNodeParamsBuilder {
3955    node_id: NodeId,
3956}
3957
3958impl SetInspectedNodeParamsBuilder {
3959    pub fn build(self) -> SetInspectedNodeParams {
3960        SetInspectedNodeParams {
3961            node_id: self.node_id,
3962        }
3963    }
3964}
3965
3966impl SetInspectedNodeParams { pub const METHOD: &'static str = "DOM.setInspectedNode"; }
3967
3968impl<'a> crate::CdpCommand<'a> for SetInspectedNodeParams {
3969    const METHOD: &'static str = "DOM.setInspectedNode";
3970    type Response = crate::EmptyReturns;
3971}
3972
3973/// Sets node name for a node with given id.
3974
3975#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3976#[serde(rename_all = "camelCase")]
3977pub struct SetNodeNameParams<'a> {
3978    /// Id of the node to set name for.
3979    #[serde(rename = "nodeId")]
3980    node_id: NodeId,
3981    /// New node's name.
3982    name: Cow<'a, str>,
3983}
3984
3985impl<'a> SetNodeNameParams<'a> {
3986    /// Creates a builder for this type with the required parameters:
3987    /// * `node_id`: Id of the node to set name for.
3988    /// * `name`: New node's name.
3989    pub fn builder(node_id: NodeId, name: impl Into<Cow<'a, str>>) -> SetNodeNameParamsBuilder<'a> {
3990        SetNodeNameParamsBuilder {
3991            node_id: node_id,
3992            name: name.into(),
3993        }
3994    }
3995    /// Id of the node to set name for.
3996    pub fn node_id(&self) -> &NodeId { &self.node_id }
3997    /// New node's name.
3998    pub fn name(&self) -> &str { self.name.as_ref() }
3999}
4000
4001
4002pub struct SetNodeNameParamsBuilder<'a> {
4003    node_id: NodeId,
4004    name: Cow<'a, str>,
4005}
4006
4007impl<'a> SetNodeNameParamsBuilder<'a> {
4008    pub fn build(self) -> SetNodeNameParams<'a> {
4009        SetNodeNameParams {
4010            node_id: self.node_id,
4011            name: self.name,
4012        }
4013    }
4014}
4015
4016/// Sets node name for a node with given id.
4017
4018#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4019#[serde(rename_all = "camelCase")]
4020pub struct SetNodeNameReturns {
4021    /// New node's id.
4022    #[serde(rename = "nodeId")]
4023    node_id: NodeId,
4024}
4025
4026impl SetNodeNameReturns {
4027    /// Creates a builder for this type with the required parameters:
4028    /// * `node_id`: New node's id.
4029    pub fn builder(node_id: NodeId) -> SetNodeNameReturnsBuilder {
4030        SetNodeNameReturnsBuilder {
4031            node_id: node_id,
4032        }
4033    }
4034    /// New node's id.
4035    pub fn node_id(&self) -> &NodeId { &self.node_id }
4036}
4037
4038
4039pub struct SetNodeNameReturnsBuilder {
4040    node_id: NodeId,
4041}
4042
4043impl SetNodeNameReturnsBuilder {
4044    pub fn build(self) -> SetNodeNameReturns {
4045        SetNodeNameReturns {
4046            node_id: self.node_id,
4047        }
4048    }
4049}
4050
4051impl<'a> SetNodeNameParams<'a> { pub const METHOD: &'static str = "DOM.setNodeName"; }
4052
4053impl<'a> crate::CdpCommand<'a> for SetNodeNameParams<'a> {
4054    const METHOD: &'static str = "DOM.setNodeName";
4055    type Response = SetNodeNameReturns;
4056}
4057
4058/// Sets node value for a node with given id.
4059
4060#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4061#[serde(rename_all = "camelCase")]
4062pub struct SetNodeValueParams<'a> {
4063    /// Id of the node to set value for.
4064    #[serde(rename = "nodeId")]
4065    node_id: NodeId,
4066    /// New node's value.
4067    value: Cow<'a, str>,
4068}
4069
4070impl<'a> SetNodeValueParams<'a> {
4071    /// Creates a builder for this type with the required parameters:
4072    /// * `node_id`: Id of the node to set value for.
4073    /// * `value`: New node's value.
4074    pub fn builder(node_id: NodeId, value: impl Into<Cow<'a, str>>) -> SetNodeValueParamsBuilder<'a> {
4075        SetNodeValueParamsBuilder {
4076            node_id: node_id,
4077            value: value.into(),
4078        }
4079    }
4080    /// Id of the node to set value for.
4081    pub fn node_id(&self) -> &NodeId { &self.node_id }
4082    /// New node's value.
4083    pub fn value(&self) -> &str { self.value.as_ref() }
4084}
4085
4086
4087pub struct SetNodeValueParamsBuilder<'a> {
4088    node_id: NodeId,
4089    value: Cow<'a, str>,
4090}
4091
4092impl<'a> SetNodeValueParamsBuilder<'a> {
4093    pub fn build(self) -> SetNodeValueParams<'a> {
4094        SetNodeValueParams {
4095            node_id: self.node_id,
4096            value: self.value,
4097        }
4098    }
4099}
4100
4101impl<'a> SetNodeValueParams<'a> { pub const METHOD: &'static str = "DOM.setNodeValue"; }
4102
4103impl<'a> crate::CdpCommand<'a> for SetNodeValueParams<'a> {
4104    const METHOD: &'static str = "DOM.setNodeValue";
4105    type Response = crate::EmptyReturns;
4106}
4107
4108/// Sets node HTML markup, returns new node id.
4109
4110#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4111#[serde(rename_all = "camelCase")]
4112pub struct SetOuterHTMLParams<'a> {
4113    /// Id of the node to set markup for.
4114    #[serde(rename = "nodeId")]
4115    node_id: NodeId,
4116    /// Outer HTML markup to set.
4117    #[serde(rename = "outerHTML")]
4118    outer_html: Cow<'a, str>,
4119}
4120
4121impl<'a> SetOuterHTMLParams<'a> {
4122    /// Creates a builder for this type with the required parameters:
4123    /// * `node_id`: Id of the node to set markup for.
4124    /// * `outer_html`: Outer HTML markup to set.
4125    pub fn builder(node_id: NodeId, outer_html: impl Into<Cow<'a, str>>) -> SetOuterHTMLParamsBuilder<'a> {
4126        SetOuterHTMLParamsBuilder {
4127            node_id: node_id,
4128            outer_html: outer_html.into(),
4129        }
4130    }
4131    /// Id of the node to set markup for.
4132    pub fn node_id(&self) -> &NodeId { &self.node_id }
4133    /// Outer HTML markup to set.
4134    pub fn outer_html(&self) -> &str { self.outer_html.as_ref() }
4135}
4136
4137
4138pub struct SetOuterHTMLParamsBuilder<'a> {
4139    node_id: NodeId,
4140    outer_html: Cow<'a, str>,
4141}
4142
4143impl<'a> SetOuterHTMLParamsBuilder<'a> {
4144    pub fn build(self) -> SetOuterHTMLParams<'a> {
4145        SetOuterHTMLParams {
4146            node_id: self.node_id,
4147            outer_html: self.outer_html,
4148        }
4149    }
4150}
4151
4152impl<'a> SetOuterHTMLParams<'a> { pub const METHOD: &'static str = "DOM.setOuterHTML"; }
4153
4154impl<'a> crate::CdpCommand<'a> for SetOuterHTMLParams<'a> {
4155    const METHOD: &'static str = "DOM.setOuterHTML";
4156    type Response = crate::EmptyReturns;
4157}
4158
4159#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4160pub struct UndoParams {}
4161
4162impl UndoParams { pub const METHOD: &'static str = "DOM.undo"; }
4163
4164impl<'a> crate::CdpCommand<'a> for UndoParams {
4165    const METHOD: &'static str = "DOM.undo";
4166    type Response = crate::EmptyReturns;
4167}
4168
4169/// Returns iframe node that owns iframe with the given domain.
4170
4171#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4172#[serde(rename_all = "camelCase")]
4173pub struct GetFrameOwnerParams<'a> {
4174    #[serde(rename = "frameId")]
4175    frame_id: crate::page::FrameId<'a>,
4176}
4177
4178impl<'a> GetFrameOwnerParams<'a> {
4179    /// Creates a builder for this type with the required parameters:
4180    /// * `frame_id`: 
4181    pub fn builder(frame_id: crate::page::FrameId<'a>) -> GetFrameOwnerParamsBuilder<'a> {
4182        GetFrameOwnerParamsBuilder {
4183            frame_id: frame_id,
4184        }
4185    }
4186    pub fn frame_id(&self) -> &crate::page::FrameId<'a> { &self.frame_id }
4187}
4188
4189
4190pub struct GetFrameOwnerParamsBuilder<'a> {
4191    frame_id: crate::page::FrameId<'a>,
4192}
4193
4194impl<'a> GetFrameOwnerParamsBuilder<'a> {
4195    pub fn build(self) -> GetFrameOwnerParams<'a> {
4196        GetFrameOwnerParams {
4197            frame_id: self.frame_id,
4198        }
4199    }
4200}
4201
4202/// Returns iframe node that owns iframe with the given domain.
4203
4204#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4205#[serde(rename_all = "camelCase")]
4206pub struct GetFrameOwnerReturns {
4207    /// Resulting node.
4208    #[serde(rename = "backendNodeId")]
4209    backend_node_id: BackendNodeId,
4210    /// Id of the node at given coordinates, only when enabled and requested document.
4211    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
4212    node_id: Option<NodeId>,
4213}
4214
4215impl GetFrameOwnerReturns {
4216    /// Creates a builder for this type with the required parameters:
4217    /// * `backend_node_id`: Resulting node.
4218    pub fn builder(backend_node_id: BackendNodeId) -> GetFrameOwnerReturnsBuilder {
4219        GetFrameOwnerReturnsBuilder {
4220            backend_node_id: backend_node_id,
4221            node_id: None,
4222        }
4223    }
4224    /// Resulting node.
4225    pub fn backend_node_id(&self) -> &BackendNodeId { &self.backend_node_id }
4226    /// Id of the node at given coordinates, only when enabled and requested document.
4227    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
4228}
4229
4230
4231pub struct GetFrameOwnerReturnsBuilder {
4232    backend_node_id: BackendNodeId,
4233    node_id: Option<NodeId>,
4234}
4235
4236impl GetFrameOwnerReturnsBuilder {
4237    /// Id of the node at given coordinates, only when enabled and requested document.
4238    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
4239    pub fn build(self) -> GetFrameOwnerReturns {
4240        GetFrameOwnerReturns {
4241            backend_node_id: self.backend_node_id,
4242            node_id: self.node_id,
4243        }
4244    }
4245}
4246
4247impl<'a> GetFrameOwnerParams<'a> { pub const METHOD: &'static str = "DOM.getFrameOwner"; }
4248
4249impl<'a> crate::CdpCommand<'a> for GetFrameOwnerParams<'a> {
4250    const METHOD: &'static str = "DOM.getFrameOwner";
4251    type Response = GetFrameOwnerReturns;
4252}
4253
4254/// Returns the query container of the given node based on container query
4255/// conditions: containerName, physical and logical axes, and whether it queries
4256/// scroll-state or anchored elements. If no axes are provided and
4257/// queriesScrollState is false, the style container is returned, which is the
4258/// direct parent or the closest element with a matching container-name.
4259
4260#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4261#[serde(rename_all = "camelCase")]
4262pub struct GetContainerForNodeParams<'a> {
4263    #[serde(rename = "nodeId")]
4264    node_id: NodeId,
4265    #[serde(skip_serializing_if = "Option::is_none", rename = "containerName")]
4266    container_name: Option<Cow<'a, str>>,
4267    #[serde(skip_serializing_if = "Option::is_none", rename = "physicalAxes")]
4268    physical_axes: Option<PhysicalAxes>,
4269    #[serde(skip_serializing_if = "Option::is_none", rename = "logicalAxes")]
4270    logical_axes: Option<LogicalAxes>,
4271    #[serde(skip_serializing_if = "Option::is_none", rename = "queriesScrollState")]
4272    queries_scroll_state: Option<bool>,
4273    #[serde(skip_serializing_if = "Option::is_none", rename = "queriesAnchored")]
4274    queries_anchored: Option<bool>,
4275}
4276
4277impl<'a> GetContainerForNodeParams<'a> {
4278    /// Creates a builder for this type with the required parameters:
4279    /// * `node_id`: 
4280    pub fn builder(node_id: NodeId) -> GetContainerForNodeParamsBuilder<'a> {
4281        GetContainerForNodeParamsBuilder {
4282            node_id: node_id,
4283            container_name: None,
4284            physical_axes: None,
4285            logical_axes: None,
4286            queries_scroll_state: None,
4287            queries_anchored: None,
4288        }
4289    }
4290    pub fn node_id(&self) -> &NodeId { &self.node_id }
4291    pub fn container_name(&self) -> Option<&str> { self.container_name.as_deref() }
4292    pub fn physical_axes(&self) -> Option<&PhysicalAxes> { self.physical_axes.as_ref() }
4293    pub fn logical_axes(&self) -> Option<&LogicalAxes> { self.logical_axes.as_ref() }
4294    pub fn queries_scroll_state(&self) -> Option<bool> { self.queries_scroll_state }
4295    pub fn queries_anchored(&self) -> Option<bool> { self.queries_anchored }
4296}
4297
4298
4299pub struct GetContainerForNodeParamsBuilder<'a> {
4300    node_id: NodeId,
4301    container_name: Option<Cow<'a, str>>,
4302    physical_axes: Option<PhysicalAxes>,
4303    logical_axes: Option<LogicalAxes>,
4304    queries_scroll_state: Option<bool>,
4305    queries_anchored: Option<bool>,
4306}
4307
4308impl<'a> GetContainerForNodeParamsBuilder<'a> {
4309    pub fn container_name(mut self, container_name: impl Into<Cow<'a, str>>) -> Self { self.container_name = Some(container_name.into()); self }
4310    pub fn physical_axes(mut self, physical_axes: impl Into<PhysicalAxes>) -> Self { self.physical_axes = Some(physical_axes.into()); self }
4311    pub fn logical_axes(mut self, logical_axes: impl Into<LogicalAxes>) -> Self { self.logical_axes = Some(logical_axes.into()); self }
4312    pub fn queries_scroll_state(mut self, queries_scroll_state: bool) -> Self { self.queries_scroll_state = Some(queries_scroll_state); self }
4313    pub fn queries_anchored(mut self, queries_anchored: bool) -> Self { self.queries_anchored = Some(queries_anchored); self }
4314    pub fn build(self) -> GetContainerForNodeParams<'a> {
4315        GetContainerForNodeParams {
4316            node_id: self.node_id,
4317            container_name: self.container_name,
4318            physical_axes: self.physical_axes,
4319            logical_axes: self.logical_axes,
4320            queries_scroll_state: self.queries_scroll_state,
4321            queries_anchored: self.queries_anchored,
4322        }
4323    }
4324}
4325
4326/// Returns the query container of the given node based on container query
4327/// conditions: containerName, physical and logical axes, and whether it queries
4328/// scroll-state or anchored elements. If no axes are provided and
4329/// queriesScrollState is false, the style container is returned, which is the
4330/// direct parent or the closest element with a matching container-name.
4331
4332#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4333#[serde(rename_all = "camelCase")]
4334pub struct GetContainerForNodeReturns {
4335    /// The container node for the given node, or null if not found.
4336    #[serde(skip_serializing_if = "Option::is_none", rename = "nodeId")]
4337    node_id: Option<NodeId>,
4338}
4339
4340impl GetContainerForNodeReturns {
4341    /// Creates a builder for this type.
4342    pub fn builder() -> GetContainerForNodeReturnsBuilder {
4343        GetContainerForNodeReturnsBuilder {
4344            node_id: None,
4345        }
4346    }
4347    /// The container node for the given node, or null if not found.
4348    pub fn node_id(&self) -> Option<&NodeId> { self.node_id.as_ref() }
4349}
4350
4351#[derive(Default)]
4352pub struct GetContainerForNodeReturnsBuilder {
4353    node_id: Option<NodeId>,
4354}
4355
4356impl GetContainerForNodeReturnsBuilder {
4357    /// The container node for the given node, or null if not found.
4358    pub fn node_id(mut self, node_id: NodeId) -> Self { self.node_id = Some(node_id); self }
4359    pub fn build(self) -> GetContainerForNodeReturns {
4360        GetContainerForNodeReturns {
4361            node_id: self.node_id,
4362        }
4363    }
4364}
4365
4366impl<'a> GetContainerForNodeParams<'a> { pub const METHOD: &'static str = "DOM.getContainerForNode"; }
4367
4368impl<'a> crate::CdpCommand<'a> for GetContainerForNodeParams<'a> {
4369    const METHOD: &'static str = "DOM.getContainerForNode";
4370    type Response = GetContainerForNodeReturns;
4371}
4372
4373/// Returns the descendants of a container query container that have
4374/// container queries against this container.
4375
4376#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4377#[serde(rename_all = "camelCase")]
4378pub struct GetQueryingDescendantsForContainerParams {
4379    /// Id of the container node to find querying descendants from.
4380    #[serde(rename = "nodeId")]
4381    node_id: NodeId,
4382}
4383
4384impl GetQueryingDescendantsForContainerParams {
4385    /// Creates a builder for this type with the required parameters:
4386    /// * `node_id`: Id of the container node to find querying descendants from.
4387    pub fn builder(node_id: NodeId) -> GetQueryingDescendantsForContainerParamsBuilder {
4388        GetQueryingDescendantsForContainerParamsBuilder {
4389            node_id: node_id,
4390        }
4391    }
4392    /// Id of the container node to find querying descendants from.
4393    pub fn node_id(&self) -> &NodeId { &self.node_id }
4394}
4395
4396
4397pub struct GetQueryingDescendantsForContainerParamsBuilder {
4398    node_id: NodeId,
4399}
4400
4401impl GetQueryingDescendantsForContainerParamsBuilder {
4402    pub fn build(self) -> GetQueryingDescendantsForContainerParams {
4403        GetQueryingDescendantsForContainerParams {
4404            node_id: self.node_id,
4405        }
4406    }
4407}
4408
4409/// Returns the descendants of a container query container that have
4410/// container queries against this container.
4411
4412#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4413#[serde(rename_all = "camelCase")]
4414pub struct GetQueryingDescendantsForContainerReturns {
4415    /// Descendant nodes with container queries against the given container.
4416    #[serde(rename = "nodeIds")]
4417    node_ids: Vec<NodeId>,
4418}
4419
4420impl GetQueryingDescendantsForContainerReturns {
4421    /// Creates a builder for this type with the required parameters:
4422    /// * `node_ids`: Descendant nodes with container queries against the given container.
4423    pub fn builder(node_ids: Vec<NodeId>) -> GetQueryingDescendantsForContainerReturnsBuilder {
4424        GetQueryingDescendantsForContainerReturnsBuilder {
4425            node_ids: node_ids,
4426        }
4427    }
4428    /// Descendant nodes with container queries against the given container.
4429    pub fn node_ids(&self) -> &[NodeId] { &self.node_ids }
4430}
4431
4432
4433pub struct GetQueryingDescendantsForContainerReturnsBuilder {
4434    node_ids: Vec<NodeId>,
4435}
4436
4437impl GetQueryingDescendantsForContainerReturnsBuilder {
4438    pub fn build(self) -> GetQueryingDescendantsForContainerReturns {
4439        GetQueryingDescendantsForContainerReturns {
4440            node_ids: self.node_ids,
4441        }
4442    }
4443}
4444
4445impl GetQueryingDescendantsForContainerParams { pub const METHOD: &'static str = "DOM.getQueryingDescendantsForContainer"; }
4446
4447impl<'a> crate::CdpCommand<'a> for GetQueryingDescendantsForContainerParams {
4448    const METHOD: &'static str = "DOM.getQueryingDescendantsForContainer";
4449    type Response = GetQueryingDescendantsForContainerReturns;
4450}
4451
4452/// Returns the target anchor element of the given anchor query according to
4453/// <https://www.w3.org/TR/css-anchor-position-1/#target>.
4454
4455#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4456#[serde(rename_all = "camelCase")]
4457pub struct GetAnchorElementParams<'a> {
4458    /// Id of the positioned element from which to find the anchor.
4459    #[serde(rename = "nodeId")]
4460    node_id: NodeId,
4461    /// An optional anchor specifier, as defined in
4462    /// <https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier>.
4463    /// If not provided, it will return the implicit anchor element for
4464    /// the given positioned element.
4465    #[serde(skip_serializing_if = "Option::is_none", rename = "anchorSpecifier")]
4466    anchor_specifier: Option<Cow<'a, str>>,
4467}
4468
4469impl<'a> GetAnchorElementParams<'a> {
4470    /// Creates a builder for this type with the required parameters:
4471    /// * `node_id`: Id of the positioned element from which to find the anchor.
4472    pub fn builder(node_id: NodeId) -> GetAnchorElementParamsBuilder<'a> {
4473        GetAnchorElementParamsBuilder {
4474            node_id: node_id,
4475            anchor_specifier: None,
4476        }
4477    }
4478    /// Id of the positioned element from which to find the anchor.
4479    pub fn node_id(&self) -> &NodeId { &self.node_id }
4480    /// An optional anchor specifier, as defined in
4481    /// <https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier>.
4482    /// If not provided, it will return the implicit anchor element for
4483    /// the given positioned element.
4484    pub fn anchor_specifier(&self) -> Option<&str> { self.anchor_specifier.as_deref() }
4485}
4486
4487
4488pub struct GetAnchorElementParamsBuilder<'a> {
4489    node_id: NodeId,
4490    anchor_specifier: Option<Cow<'a, str>>,
4491}
4492
4493impl<'a> GetAnchorElementParamsBuilder<'a> {
4494    /// An optional anchor specifier, as defined in
4495    /// <https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier>.
4496    /// If not provided, it will return the implicit anchor element for
4497    /// the given positioned element.
4498    pub fn anchor_specifier(mut self, anchor_specifier: impl Into<Cow<'a, str>>) -> Self { self.anchor_specifier = Some(anchor_specifier.into()); self }
4499    pub fn build(self) -> GetAnchorElementParams<'a> {
4500        GetAnchorElementParams {
4501            node_id: self.node_id,
4502            anchor_specifier: self.anchor_specifier,
4503        }
4504    }
4505}
4506
4507/// Returns the target anchor element of the given anchor query according to
4508/// <https://www.w3.org/TR/css-anchor-position-1/#target>.
4509
4510#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4511#[serde(rename_all = "camelCase")]
4512pub struct GetAnchorElementReturns {
4513    /// The anchor element of the given anchor query.
4514    #[serde(rename = "nodeId")]
4515    node_id: NodeId,
4516}
4517
4518impl GetAnchorElementReturns {
4519    /// Creates a builder for this type with the required parameters:
4520    /// * `node_id`: The anchor element of the given anchor query.
4521    pub fn builder(node_id: NodeId) -> GetAnchorElementReturnsBuilder {
4522        GetAnchorElementReturnsBuilder {
4523            node_id: node_id,
4524        }
4525    }
4526    /// The anchor element of the given anchor query.
4527    pub fn node_id(&self) -> &NodeId { &self.node_id }
4528}
4529
4530
4531pub struct GetAnchorElementReturnsBuilder {
4532    node_id: NodeId,
4533}
4534
4535impl GetAnchorElementReturnsBuilder {
4536    pub fn build(self) -> GetAnchorElementReturns {
4537        GetAnchorElementReturns {
4538            node_id: self.node_id,
4539        }
4540    }
4541}
4542
4543impl<'a> GetAnchorElementParams<'a> { pub const METHOD: &'static str = "DOM.getAnchorElement"; }
4544
4545impl<'a> crate::CdpCommand<'a> for GetAnchorElementParams<'a> {
4546    const METHOD: &'static str = "DOM.getAnchorElement";
4547    type Response = GetAnchorElementReturns;
4548}
4549
4550/// When enabling, this API force-opens the popover identified by nodeId
4551/// and keeps it open until disabled.
4552
4553#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4554#[serde(rename_all = "camelCase")]
4555pub struct ForceShowPopoverParams {
4556    /// Id of the popover HTMLElement
4557    #[serde(rename = "nodeId")]
4558    node_id: NodeId,
4559    /// If true, opens the popover and keeps it open. If false, closes the
4560    /// popover if it was previously force-opened.
4561    enable: bool,
4562}
4563
4564impl ForceShowPopoverParams {
4565    /// Creates a builder for this type with the required parameters:
4566    /// * `node_id`: Id of the popover HTMLElement
4567    /// * `enable`: If true, opens the popover and keeps it open. If false, closes the popover if it was previously force-opened.
4568    pub fn builder(node_id: NodeId, enable: bool) -> ForceShowPopoverParamsBuilder {
4569        ForceShowPopoverParamsBuilder {
4570            node_id: node_id,
4571            enable: enable,
4572        }
4573    }
4574    /// Id of the popover HTMLElement
4575    pub fn node_id(&self) -> &NodeId { &self.node_id }
4576    /// If true, opens the popover and keeps it open. If false, closes the
4577    /// popover if it was previously force-opened.
4578    pub fn enable(&self) -> bool { self.enable }
4579}
4580
4581
4582pub struct ForceShowPopoverParamsBuilder {
4583    node_id: NodeId,
4584    enable: bool,
4585}
4586
4587impl ForceShowPopoverParamsBuilder {
4588    pub fn build(self) -> ForceShowPopoverParams {
4589        ForceShowPopoverParams {
4590            node_id: self.node_id,
4591            enable: self.enable,
4592        }
4593    }
4594}
4595
4596/// When enabling, this API force-opens the popover identified by nodeId
4597/// and keeps it open until disabled.
4598
4599#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4600#[serde(rename_all = "camelCase")]
4601pub struct ForceShowPopoverReturns {
4602    /// List of popovers that were closed in order to respect popover stacking order.
4603    #[serde(rename = "nodeIds")]
4604    node_ids: Vec<NodeId>,
4605}
4606
4607impl ForceShowPopoverReturns {
4608    /// Creates a builder for this type with the required parameters:
4609    /// * `node_ids`: List of popovers that were closed in order to respect popover stacking order.
4610    pub fn builder(node_ids: Vec<NodeId>) -> ForceShowPopoverReturnsBuilder {
4611        ForceShowPopoverReturnsBuilder {
4612            node_ids: node_ids,
4613        }
4614    }
4615    /// List of popovers that were closed in order to respect popover stacking order.
4616    pub fn node_ids(&self) -> &[NodeId] { &self.node_ids }
4617}
4618
4619
4620pub struct ForceShowPopoverReturnsBuilder {
4621    node_ids: Vec<NodeId>,
4622}
4623
4624impl ForceShowPopoverReturnsBuilder {
4625    pub fn build(self) -> ForceShowPopoverReturns {
4626        ForceShowPopoverReturns {
4627            node_ids: self.node_ids,
4628        }
4629    }
4630}
4631
4632impl ForceShowPopoverParams { pub const METHOD: &'static str = "DOM.forceShowPopover"; }
4633
4634impl<'a> crate::CdpCommand<'a> for ForceShowPopoverParams {
4635    const METHOD: &'static str = "DOM.forceShowPopover";
4636    type Response = ForceShowPopoverReturns;
4637}