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.
8use serde::{Serialize, Deserialize};
9use serde_json::Value as JsonValue;
10
11/// Unique DOM node identifier.
12
13pub type NodeId = i64;
14
15/// Unique DOM node identifier used to reference a node that may not have been pushed to the
16/// front-end.
17
18pub type BackendNodeId = i64;
19
20/// Unique identifier for a CSS stylesheet.
21
22pub type StyleSheetId = String;
23
24/// Backend node with a friendly name.
25
26#[derive(Debug, Clone, Serialize, Deserialize, Default)]
27#[serde(rename_all = "camelCase")]
28pub struct BackendNode {
29    /// 'Node''s nodeType.
30
31    pub nodeType: i64,
32    /// 'Node''s nodeName.
33
34    pub nodeName: String,
35
36    pub backendNodeId: BackendNodeId,
37}
38
39/// Pseudo element type.
40
41#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
42pub enum PseudoType {
43    #[default]
44    FirstLine,
45    FirstLetter,
46    Checkmark,
47    Before,
48    After,
49    ExpandIcon,
50    PickerIcon,
51    InterestHint,
52    Marker,
53    Backdrop,
54    Column,
55    Selection,
56    SearchText,
57    TargetText,
58    SpellingError,
59    GrammarError,
60    Highlight,
61    FirstLineInherited,
62    ScrollMarker,
63    ScrollMarkerGroup,
64    ScrollButton,
65    Scrollbar,
66    ScrollbarThumb,
67    ScrollbarButton,
68    ScrollbarTrack,
69    ScrollbarTrackPiece,
70    ScrollbarCorner,
71    Resizer,
72    InputListButton,
73    ViewTransition,
74    ViewTransitionGroup,
75    ViewTransitionImagePair,
76    ViewTransitionGroupChildren,
77    ViewTransitionOld,
78    ViewTransitionNew,
79    Placeholder,
80    FileSelectorButton,
81    DetailsContent,
82    Picker,
83    PermissionIcon,
84    OverscrollAreaParent,
85}
86
87/// Shadow root type.
88
89#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
90pub enum ShadowRootType {
91    #[default]
92    UserAgent,
93    Open,
94    Closed,
95}
96
97/// Document compatibility mode.
98
99#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
100pub enum CompatibilityMode {
101    #[default]
102    QuirksMode,
103    LimitedQuirksMode,
104    NoQuirksMode,
105}
106
107/// ContainerSelector physical axes
108
109#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
110pub enum PhysicalAxes {
111    #[default]
112    Horizontal,
113    Vertical,
114    Both,
115}
116
117/// ContainerSelector logical axes
118
119#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
120pub enum LogicalAxes {
121    #[default]
122    Inline,
123    Block,
124    Both,
125}
126
127/// Physical scroll orientation
128
129#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
130pub enum ScrollOrientation {
131    #[default]
132    Horizontal,
133    Vertical,
134}
135
136/// DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.
137/// DOMNode is a base node mirror type.
138
139#[derive(Debug, Clone, Serialize, Deserialize, Default)]
140#[serde(rename_all = "camelCase")]
141pub struct Node {
142    /// Node identifier that is passed into the rest of the DOM messages as the 'nodeId'. Backend
143    /// will only push node with given 'id' once. It is aware of all requested nodes and will only
144    /// fire DOM events for nodes known to the client.
145
146    pub nodeId: NodeId,
147    /// The id of the parent node if any.
148
149    #[serde(skip_serializing_if = "Option::is_none")]
150    pub parentId: Option<NodeId>,
151    /// The BackendNodeId for this node.
152
153    pub backendNodeId: BackendNodeId,
154    /// 'Node''s nodeType.
155
156    pub nodeType: i64,
157    /// 'Node''s nodeName.
158
159    pub nodeName: String,
160    /// 'Node''s localName.
161
162    pub localName: String,
163    /// 'Node''s nodeValue.
164
165    pub nodeValue: String,
166    /// Child count for 'Container' nodes.
167
168    #[serde(skip_serializing_if = "Option::is_none")]
169    pub childNodeCount: Option<u64>,
170    /// Child nodes of this node when requested with children.
171
172    #[serde(skip_serializing_if = "Option::is_none")]
173    pub children: Option<Vec<Node>>,
174    /// Attributes of the 'Element' node in the form of flat array '[name1, value1, name2, value2]'.
175
176    #[serde(skip_serializing_if = "Option::is_none")]
177    pub attributes: Option<Vec<String>>,
178    /// Document URL that 'Document' or 'FrameOwner' node points to.
179
180    #[serde(skip_serializing_if = "Option::is_none")]
181    pub documentURL: Option<String>,
182    /// Base URL that 'Document' or 'FrameOwner' node uses for URL completion.
183
184    #[serde(skip_serializing_if = "Option::is_none")]
185    pub baseURL: Option<String>,
186    /// 'DocumentType''s publicId.
187
188    #[serde(skip_serializing_if = "Option::is_none")]
189    pub publicId: Option<String>,
190    /// 'DocumentType''s systemId.
191
192    #[serde(skip_serializing_if = "Option::is_none")]
193    pub systemId: Option<String>,
194    /// 'DocumentType''s internalSubset.
195
196    #[serde(skip_serializing_if = "Option::is_none")]
197    pub internalSubset: Option<String>,
198    /// 'Document''s XML version in case of XML documents.
199
200    #[serde(skip_serializing_if = "Option::is_none")]
201    pub xmlVersion: Option<String>,
202    /// 'Attr''s name.
203
204    #[serde(skip_serializing_if = "Option::is_none")]
205    pub name: Option<String>,
206    /// 'Attr''s value.
207
208    #[serde(skip_serializing_if = "Option::is_none")]
209    pub value: Option<String>,
210    /// Pseudo element type for this node.
211
212    #[serde(skip_serializing_if = "Option::is_none")]
213    pub pseudoType: Option<PseudoType>,
214    /// Pseudo element identifier for this node. Only present if there is a
215    /// valid pseudoType.
216
217    #[serde(skip_serializing_if = "Option::is_none")]
218    pub pseudoIdentifier: Option<String>,
219    /// Shadow root type.
220
221    #[serde(skip_serializing_if = "Option::is_none")]
222    pub shadowRootType: Option<ShadowRootType>,
223    /// Frame ID for frame owner elements.
224
225    #[serde(skip_serializing_if = "Option::is_none")]
226    pub frameId: Option<crate::page::FrameId>,
227    /// Content document for frame owner elements.
228
229    #[serde(skip_serializing_if = "Option::is_none")]
230    pub contentDocument: Option<Box<Node>>,
231    /// Shadow root list for given element host.
232
233    #[serde(skip_serializing_if = "Option::is_none")]
234    pub shadowRoots: Option<Vec<Node>>,
235    /// Content document fragment for template elements.
236
237    #[serde(skip_serializing_if = "Option::is_none")]
238    pub templateContent: Option<Box<Node>>,
239    /// Pseudo elements associated with this node.
240
241    #[serde(skip_serializing_if = "Option::is_none")]
242    pub pseudoElements: Option<Vec<Node>>,
243    /// Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
244    /// This property used to return the imported document for the HTMLImport links.
245    /// The property is always undefined now.
246
247    #[serde(skip_serializing_if = "Option::is_none")]
248    pub importedDocument: Option<Box<Node>>,
249    /// Distributed nodes for given insertion point.
250
251    #[serde(skip_serializing_if = "Option::is_none")]
252    pub distributedNodes: Option<Vec<BackendNode>>,
253    /// Whether the node is SVG.
254
255    #[serde(skip_serializing_if = "Option::is_none")]
256    pub isSVG: Option<bool>,
257
258    #[serde(skip_serializing_if = "Option::is_none")]
259    pub compatibilityMode: Option<CompatibilityMode>,
260
261    #[serde(skip_serializing_if = "Option::is_none")]
262    pub assignedSlot: Option<BackendNode>,
263
264    #[serde(skip_serializing_if = "Option::is_none")]
265    pub isScrollable: Option<bool>,
266
267    #[serde(skip_serializing_if = "Option::is_none")]
268    pub affectedByStartingStyles: Option<bool>,
269
270    #[serde(skip_serializing_if = "Option::is_none")]
271    pub adoptedStyleSheets: Option<Vec<StyleSheetId>>,
272
273    #[serde(skip_serializing_if = "Option::is_none")]
274    pub adProvenance: Option<crate::network::AdProvenance>,
275}
276
277/// A structure to hold the top-level node of a detached tree and an array of its retained descendants.
278
279#[derive(Debug, Clone, Serialize, Deserialize, Default)]
280#[serde(rename_all = "camelCase")]
281pub struct DetachedElementInfo {
282
283    pub treeNode: Node,
284
285    pub retainedNodeIds: Vec<NodeId>,
286}
287
288/// A structure holding an RGBA color.
289
290#[derive(Debug, Clone, Serialize, Deserialize, Default)]
291#[serde(rename_all = "camelCase")]
292pub struct RGBA {
293    /// The red component, in the [0-255] range.
294
295    pub r: i64,
296    /// The green component, in the [0-255] range.
297
298    pub g: i64,
299    /// The blue component, in the [0-255] range.
300
301    pub b: i64,
302    /// The alpha component, in the [0-1] range (default: 1).
303
304    #[serde(skip_serializing_if = "Option::is_none")]
305    pub a: Option<f64>,
306}
307
308/// An array of quad vertices, x immediately followed by y for each point, points clock-wise.
309
310pub type Quad = Vec<f64>;
311
312/// Box model.
313
314#[derive(Debug, Clone, Serialize, Deserialize, Default)]
315#[serde(rename_all = "camelCase")]
316pub struct BoxModel {
317    /// Content box
318
319    pub content: Quad,
320    /// Padding box
321
322    pub padding: Quad,
323    /// Border box
324
325    pub border: Quad,
326    /// Margin box
327
328    pub margin: Quad,
329    /// Node width
330
331    pub width: u64,
332    /// Node height
333
334    pub height: i64,
335    /// Shape outside coordinates
336
337    #[serde(skip_serializing_if = "Option::is_none")]
338    pub shapeOutside: Option<ShapeOutsideInfo>,
339}
340
341/// CSS Shape Outside details.
342
343#[derive(Debug, Clone, Serialize, Deserialize, Default)]
344#[serde(rename_all = "camelCase")]
345pub struct ShapeOutsideInfo {
346    /// Shape bounds
347
348    pub bounds: Quad,
349    /// Shape coordinate details
350
351    pub shape: Vec<JsonValue>,
352    /// Margin shape bounds
353
354    pub marginShape: Vec<JsonValue>,
355}
356
357/// Rectangle.
358
359#[derive(Debug, Clone, Serialize, Deserialize, Default)]
360#[serde(rename_all = "camelCase")]
361pub struct Rect {
362    /// X coordinate
363
364    pub x: f64,
365    /// Y coordinate
366
367    pub y: f64,
368    /// Rectangle width
369
370    pub width: f64,
371    /// Rectangle height
372
373    pub height: f64,
374}
375
376
377#[derive(Debug, Clone, Serialize, Deserialize, Default)]
378#[serde(rename_all = "camelCase")]
379pub struct CSSComputedStyleProperty {
380    /// Computed style property name.
381
382    pub name: String,
383    /// Computed style property value.
384
385    pub value: String,
386}
387
388/// Collects class names for the node with given id and all of it's child nodes.
389
390#[derive(Debug, Clone, Serialize, Deserialize, Default)]
391#[serde(rename_all = "camelCase")]
392pub struct CollectClassNamesFromSubtreeParams {
393    /// Id of the node to collect class names.
394
395    pub nodeId: NodeId,
396}
397
398/// Collects class names for the node with given id and all of it's child nodes.
399
400#[derive(Debug, Clone, Serialize, Deserialize, Default)]
401#[serde(rename_all = "camelCase")]
402pub struct CollectClassNamesFromSubtreeReturns {
403    /// Class name list.
404
405    pub classNames: Vec<String>,
406}
407
408impl CollectClassNamesFromSubtreeParams { pub const METHOD: &'static str = "DOM.collectClassNamesFromSubtree"; }
409
410impl crate::CdpCommand for CollectClassNamesFromSubtreeParams {
411    const METHOD: &'static str = "DOM.collectClassNamesFromSubtree";
412    type Response = CollectClassNamesFromSubtreeReturns;
413}
414
415/// Creates a deep copy of the specified node and places it into the target container before the
416/// given anchor.
417
418#[derive(Debug, Clone, Serialize, Deserialize, Default)]
419#[serde(rename_all = "camelCase")]
420pub struct CopyToParams {
421    /// Id of the node to copy.
422
423    pub nodeId: NodeId,
424    /// Id of the element to drop the copy into.
425
426    pub targetNodeId: NodeId,
427    /// Drop the copy before this node (if absent, the copy becomes the last child of
428    /// 'targetNodeId').
429
430    #[serde(skip_serializing_if = "Option::is_none")]
431    pub insertBeforeNodeId: Option<NodeId>,
432}
433
434/// Creates a deep copy of the specified node and places it into the target container before the
435/// given anchor.
436
437#[derive(Debug, Clone, Serialize, Deserialize, Default)]
438#[serde(rename_all = "camelCase")]
439pub struct CopyToReturns {
440    /// Id of the node clone.
441
442    pub nodeId: NodeId,
443}
444
445impl CopyToParams { pub const METHOD: &'static str = "DOM.copyTo"; }
446
447impl crate::CdpCommand for CopyToParams {
448    const METHOD: &'static str = "DOM.copyTo";
449    type Response = CopyToReturns;
450}
451
452/// Describes node given its id, does not require domain to be enabled. Does not start tracking any
453/// objects, can be used for automation.
454
455#[derive(Debug, Clone, Serialize, Deserialize, Default)]
456#[serde(rename_all = "camelCase")]
457pub struct DescribeNodeParams {
458    /// Identifier of the node.
459
460    #[serde(skip_serializing_if = "Option::is_none")]
461    pub nodeId: Option<NodeId>,
462    /// Identifier of the backend node.
463
464    #[serde(skip_serializing_if = "Option::is_none")]
465    pub backendNodeId: Option<BackendNodeId>,
466    /// JavaScript object id of the node wrapper.
467
468    #[serde(skip_serializing_if = "Option::is_none")]
469    pub objectId: Option<crate::runtime::RemoteObjectId>,
470    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
471    /// entire subtree or provide an integer larger than 0.
472
473    #[serde(skip_serializing_if = "Option::is_none")]
474    pub depth: Option<i64>,
475    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
476    /// (default is false).
477
478    #[serde(skip_serializing_if = "Option::is_none")]
479    pub pierce: Option<bool>,
480}
481
482/// Describes node given its id, does not require domain to be enabled. Does not start tracking any
483/// objects, can be used for automation.
484
485#[derive(Debug, Clone, Serialize, Deserialize, Default)]
486#[serde(rename_all = "camelCase")]
487pub struct DescribeNodeReturns {
488    /// Node description.
489
490    pub node: Node,
491}
492
493impl DescribeNodeParams { pub const METHOD: &'static str = "DOM.describeNode"; }
494
495impl crate::CdpCommand for DescribeNodeParams {
496    const METHOD: &'static str = "DOM.describeNode";
497    type Response = DescribeNodeReturns;
498}
499
500/// Scrolls the specified rect of the given node into view if not already visible.
501/// Note: exactly one between nodeId, backendNodeId and objectId should be passed
502/// to identify the node.
503
504#[derive(Debug, Clone, Serialize, Deserialize, Default)]
505#[serde(rename_all = "camelCase")]
506pub struct ScrollIntoViewIfNeededParams {
507    /// Identifier of the node.
508
509    #[serde(skip_serializing_if = "Option::is_none")]
510    pub nodeId: Option<NodeId>,
511    /// Identifier of the backend node.
512
513    #[serde(skip_serializing_if = "Option::is_none")]
514    pub backendNodeId: Option<BackendNodeId>,
515    /// JavaScript object id of the node wrapper.
516
517    #[serde(skip_serializing_if = "Option::is_none")]
518    pub objectId: Option<crate::runtime::RemoteObjectId>,
519    /// The rect to be scrolled into view, relative to the node's border box, in CSS pixels.
520    /// When omitted, center of the node will be used, similar to Element.scrollIntoView.
521
522    #[serde(skip_serializing_if = "Option::is_none")]
523    pub rect: Option<Rect>,
524}
525
526impl ScrollIntoViewIfNeededParams { pub const METHOD: &'static str = "DOM.scrollIntoViewIfNeeded"; }
527
528impl crate::CdpCommand for ScrollIntoViewIfNeededParams {
529    const METHOD: &'static str = "DOM.scrollIntoViewIfNeeded";
530    type Response = crate::EmptyReturns;
531}
532
533#[derive(Debug, Clone, Serialize, Deserialize, Default)]
534pub struct DisableParams {}
535
536impl DisableParams { pub const METHOD: &'static str = "DOM.disable"; }
537
538impl crate::CdpCommand for DisableParams {
539    const METHOD: &'static str = "DOM.disable";
540    type Response = crate::EmptyReturns;
541}
542
543/// Discards search results from the session with the given id. 'getSearchResults' should no longer
544/// be called for that search.
545
546#[derive(Debug, Clone, Serialize, Deserialize, Default)]
547#[serde(rename_all = "camelCase")]
548pub struct DiscardSearchResultsParams {
549    /// Unique search session identifier.
550
551    pub searchId: String,
552}
553
554impl DiscardSearchResultsParams { pub const METHOD: &'static str = "DOM.discardSearchResults"; }
555
556impl crate::CdpCommand for DiscardSearchResultsParams {
557    const METHOD: &'static str = "DOM.discardSearchResults";
558    type Response = crate::EmptyReturns;
559}
560
561/// Enables DOM agent for the given page.
562
563#[derive(Debug, Clone, Serialize, Deserialize, Default)]
564#[serde(rename_all = "camelCase")]
565pub struct EnableParams {
566    /// Whether to include whitespaces in the children array of returned Nodes.
567
568    #[serde(skip_serializing_if = "Option::is_none")]
569    pub includeWhitespace: Option<String>,
570}
571
572impl EnableParams { pub const METHOD: &'static str = "DOM.enable"; }
573
574impl crate::CdpCommand for EnableParams {
575    const METHOD: &'static str = "DOM.enable";
576    type Response = crate::EmptyReturns;
577}
578
579/// Focuses the given element.
580
581#[derive(Debug, Clone, Serialize, Deserialize, Default)]
582#[serde(rename_all = "camelCase")]
583pub struct FocusParams {
584    /// Identifier of the node.
585
586    #[serde(skip_serializing_if = "Option::is_none")]
587    pub nodeId: Option<NodeId>,
588    /// Identifier of the backend node.
589
590    #[serde(skip_serializing_if = "Option::is_none")]
591    pub backendNodeId: Option<BackendNodeId>,
592    /// JavaScript object id of the node wrapper.
593
594    #[serde(skip_serializing_if = "Option::is_none")]
595    pub objectId: Option<crate::runtime::RemoteObjectId>,
596}
597
598impl FocusParams { pub const METHOD: &'static str = "DOM.focus"; }
599
600impl crate::CdpCommand for FocusParams {
601    const METHOD: &'static str = "DOM.focus";
602    type Response = crate::EmptyReturns;
603}
604
605/// Returns attributes for the specified node.
606
607#[derive(Debug, Clone, Serialize, Deserialize, Default)]
608#[serde(rename_all = "camelCase")]
609pub struct GetAttributesParams {
610    /// Id of the node to retrieve attributes for.
611
612    pub nodeId: NodeId,
613}
614
615/// Returns attributes for the specified node.
616
617#[derive(Debug, Clone, Serialize, Deserialize, Default)]
618#[serde(rename_all = "camelCase")]
619pub struct GetAttributesReturns {
620    /// An interleaved array of node attribute names and values.
621
622    pub attributes: Vec<String>,
623}
624
625impl GetAttributesParams { pub const METHOD: &'static str = "DOM.getAttributes"; }
626
627impl crate::CdpCommand for GetAttributesParams {
628    const METHOD: &'static str = "DOM.getAttributes";
629    type Response = GetAttributesReturns;
630}
631
632/// Returns boxes for the given node.
633
634#[derive(Debug, Clone, Serialize, Deserialize, Default)]
635#[serde(rename_all = "camelCase")]
636pub struct GetBoxModelParams {
637    /// Identifier of the node.
638
639    #[serde(skip_serializing_if = "Option::is_none")]
640    pub nodeId: Option<NodeId>,
641    /// Identifier of the backend node.
642
643    #[serde(skip_serializing_if = "Option::is_none")]
644    pub backendNodeId: Option<BackendNodeId>,
645    /// JavaScript object id of the node wrapper.
646
647    #[serde(skip_serializing_if = "Option::is_none")]
648    pub objectId: Option<crate::runtime::RemoteObjectId>,
649}
650
651/// Returns boxes for the given node.
652
653#[derive(Debug, Clone, Serialize, Deserialize, Default)]
654#[serde(rename_all = "camelCase")]
655pub struct GetBoxModelReturns {
656    /// Box model for the node.
657
658    pub model: BoxModel,
659}
660
661impl GetBoxModelParams { pub const METHOD: &'static str = "DOM.getBoxModel"; }
662
663impl crate::CdpCommand for GetBoxModelParams {
664    const METHOD: &'static str = "DOM.getBoxModel";
665    type Response = GetBoxModelReturns;
666}
667
668/// Returns quads that describe node position on the page. This method
669/// might return multiple quads for inline nodes.
670
671#[derive(Debug, Clone, Serialize, Deserialize, Default)]
672#[serde(rename_all = "camelCase")]
673pub struct GetContentQuadsParams {
674    /// Identifier of the node.
675
676    #[serde(skip_serializing_if = "Option::is_none")]
677    pub nodeId: Option<NodeId>,
678    /// Identifier of the backend node.
679
680    #[serde(skip_serializing_if = "Option::is_none")]
681    pub backendNodeId: Option<BackendNodeId>,
682    /// JavaScript object id of the node wrapper.
683
684    #[serde(skip_serializing_if = "Option::is_none")]
685    pub objectId: Option<crate::runtime::RemoteObjectId>,
686}
687
688/// Returns quads that describe node position on the page. This method
689/// might return multiple quads for inline nodes.
690
691#[derive(Debug, Clone, Serialize, Deserialize, Default)]
692#[serde(rename_all = "camelCase")]
693pub struct GetContentQuadsReturns {
694    /// Quads that describe node layout relative to viewport.
695
696    pub quads: Vec<Quad>,
697}
698
699impl GetContentQuadsParams { pub const METHOD: &'static str = "DOM.getContentQuads"; }
700
701impl crate::CdpCommand for GetContentQuadsParams {
702    const METHOD: &'static str = "DOM.getContentQuads";
703    type Response = GetContentQuadsReturns;
704}
705
706/// Returns the root DOM node (and optionally the subtree) to the caller.
707/// Implicitly enables the DOM domain events for the current target.
708
709#[derive(Debug, Clone, Serialize, Deserialize, Default)]
710#[serde(rename_all = "camelCase")]
711pub struct GetDocumentParams {
712    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
713    /// entire subtree or provide an integer larger than 0.
714
715    #[serde(skip_serializing_if = "Option::is_none")]
716    pub depth: Option<i64>,
717    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
718    /// (default is false).
719
720    #[serde(skip_serializing_if = "Option::is_none")]
721    pub pierce: Option<bool>,
722}
723
724/// Returns the root DOM node (and optionally the subtree) to the caller.
725/// Implicitly enables the DOM domain events for the current target.
726
727#[derive(Debug, Clone, Serialize, Deserialize, Default)]
728#[serde(rename_all = "camelCase")]
729pub struct GetDocumentReturns {
730    /// Resulting node.
731
732    pub root: Node,
733}
734
735impl GetDocumentParams { pub const METHOD: &'static str = "DOM.getDocument"; }
736
737impl crate::CdpCommand for GetDocumentParams {
738    const METHOD: &'static str = "DOM.getDocument";
739    type Response = GetDocumentReturns;
740}
741
742/// Returns the root DOM node (and optionally the subtree) to the caller.
743/// Deprecated, as it is not designed to work well with the rest of the DOM agent.
744/// Use DOMSnapshot.captureSnapshot instead.
745
746#[derive(Debug, Clone, Serialize, Deserialize, Default)]
747#[serde(rename_all = "camelCase")]
748pub struct GetFlattenedDocumentParams {
749    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
750    /// entire subtree or provide an integer larger than 0.
751
752    #[serde(skip_serializing_if = "Option::is_none")]
753    pub depth: Option<i64>,
754    /// Whether or not iframes and shadow roots should be traversed when returning the subtree
755    /// (default is false).
756
757    #[serde(skip_serializing_if = "Option::is_none")]
758    pub pierce: Option<bool>,
759}
760
761/// Returns the root DOM node (and optionally the subtree) to the caller.
762/// Deprecated, as it is not designed to work well with the rest of the DOM agent.
763/// Use DOMSnapshot.captureSnapshot instead.
764
765#[derive(Debug, Clone, Serialize, Deserialize, Default)]
766#[serde(rename_all = "camelCase")]
767pub struct GetFlattenedDocumentReturns {
768    /// Resulting node.
769
770    pub nodes: Vec<Node>,
771}
772
773impl GetFlattenedDocumentParams { pub const METHOD: &'static str = "DOM.getFlattenedDocument"; }
774
775impl crate::CdpCommand for GetFlattenedDocumentParams {
776    const METHOD: &'static str = "DOM.getFlattenedDocument";
777    type Response = GetFlattenedDocumentReturns;
778}
779
780/// Finds nodes with a given computed style in a subtree.
781
782#[derive(Debug, Clone, Serialize, Deserialize, Default)]
783#[serde(rename_all = "camelCase")]
784pub struct GetNodesForSubtreeByStyleParams {
785    /// Node ID pointing to the root of a subtree.
786
787    pub nodeId: NodeId,
788    /// The style to filter nodes by (includes nodes if any of properties matches).
789
790    pub computedStyles: Vec<CSSComputedStyleProperty>,
791    /// Whether or not iframes and shadow roots in the same target should be traversed when returning the
792    /// results (default is false).
793
794    #[serde(skip_serializing_if = "Option::is_none")]
795    pub pierce: Option<bool>,
796}
797
798/// Finds nodes with a given computed style in a subtree.
799
800#[derive(Debug, Clone, Serialize, Deserialize, Default)]
801#[serde(rename_all = "camelCase")]
802pub struct GetNodesForSubtreeByStyleReturns {
803    /// Resulting nodes.
804
805    pub nodeIds: Vec<NodeId>,
806}
807
808impl GetNodesForSubtreeByStyleParams { pub const METHOD: &'static str = "DOM.getNodesForSubtreeByStyle"; }
809
810impl crate::CdpCommand for GetNodesForSubtreeByStyleParams {
811    const METHOD: &'static str = "DOM.getNodesForSubtreeByStyle";
812    type Response = GetNodesForSubtreeByStyleReturns;
813}
814
815/// Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is
816/// either returned or not.
817
818#[derive(Debug, Clone, Serialize, Deserialize, Default)]
819#[serde(rename_all = "camelCase")]
820pub struct GetNodeForLocationParams {
821    /// X coordinate.
822
823    pub x: i32,
824    /// Y coordinate.
825
826    pub y: i32,
827    /// False to skip to the nearest non-UA shadow root ancestor (default: false).
828
829    #[serde(skip_serializing_if = "Option::is_none")]
830    pub includeUserAgentShadowDOM: Option<bool>,
831    /// Whether to ignore pointer-events: none on elements and hit test them.
832
833    #[serde(skip_serializing_if = "Option::is_none")]
834    pub ignorePointerEventsNone: Option<bool>,
835}
836
837/// Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is
838/// either returned or not.
839
840#[derive(Debug, Clone, Serialize, Deserialize, Default)]
841#[serde(rename_all = "camelCase")]
842pub struct GetNodeForLocationReturns {
843    /// Resulting node.
844
845    pub backendNodeId: BackendNodeId,
846    /// Frame this node belongs to.
847
848    pub frameId: crate::page::FrameId,
849    /// Id of the node at given coordinates, only when enabled and requested document.
850
851    #[serde(skip_serializing_if = "Option::is_none")]
852    pub nodeId: Option<NodeId>,
853}
854
855impl GetNodeForLocationParams { pub const METHOD: &'static str = "DOM.getNodeForLocation"; }
856
857impl crate::CdpCommand for GetNodeForLocationParams {
858    const METHOD: &'static str = "DOM.getNodeForLocation";
859    type Response = GetNodeForLocationReturns;
860}
861
862/// Returns node's HTML markup.
863
864#[derive(Debug, Clone, Serialize, Deserialize, Default)]
865#[serde(rename_all = "camelCase")]
866pub struct GetOuterHTMLParams {
867    /// Identifier of the node.
868
869    #[serde(skip_serializing_if = "Option::is_none")]
870    pub nodeId: Option<NodeId>,
871    /// Identifier of the backend node.
872
873    #[serde(skip_serializing_if = "Option::is_none")]
874    pub backendNodeId: Option<BackendNodeId>,
875    /// JavaScript object id of the node wrapper.
876
877    #[serde(skip_serializing_if = "Option::is_none")]
878    pub objectId: Option<crate::runtime::RemoteObjectId>,
879    /// Include all shadow roots. Equals to false if not specified.
880
881    #[serde(skip_serializing_if = "Option::is_none")]
882    pub includeShadowDOM: Option<bool>,
883}
884
885/// Returns node's HTML markup.
886
887#[derive(Debug, Clone, Serialize, Deserialize, Default)]
888#[serde(rename_all = "camelCase")]
889pub struct GetOuterHTMLReturns {
890    /// Outer HTML markup.
891
892    pub outerHTML: String,
893}
894
895impl GetOuterHTMLParams { pub const METHOD: &'static str = "DOM.getOuterHTML"; }
896
897impl crate::CdpCommand for GetOuterHTMLParams {
898    const METHOD: &'static str = "DOM.getOuterHTML";
899    type Response = GetOuterHTMLReturns;
900}
901
902/// Returns the id of the nearest ancestor that is a relayout boundary.
903
904#[derive(Debug, Clone, Serialize, Deserialize, Default)]
905#[serde(rename_all = "camelCase")]
906pub struct GetRelayoutBoundaryParams {
907    /// Id of the node.
908
909    pub nodeId: NodeId,
910}
911
912/// Returns the id of the nearest ancestor that is a relayout boundary.
913
914#[derive(Debug, Clone, Serialize, Deserialize, Default)]
915#[serde(rename_all = "camelCase")]
916pub struct GetRelayoutBoundaryReturns {
917    /// Relayout boundary node id for the given node.
918
919    pub nodeId: NodeId,
920}
921
922impl GetRelayoutBoundaryParams { pub const METHOD: &'static str = "DOM.getRelayoutBoundary"; }
923
924impl crate::CdpCommand for GetRelayoutBoundaryParams {
925    const METHOD: &'static str = "DOM.getRelayoutBoundary";
926    type Response = GetRelayoutBoundaryReturns;
927}
928
929/// Returns search results from given 'fromIndex' to given 'toIndex' from the search with the given
930/// identifier.
931
932#[derive(Debug, Clone, Serialize, Deserialize, Default)]
933#[serde(rename_all = "camelCase")]
934pub struct GetSearchResultsParams {
935    /// Unique search session identifier.
936
937    pub searchId: String,
938    /// Start index of the search result to be returned.
939
940    pub fromIndex: u64,
941    /// End index of the search result to be returned.
942
943    pub toIndex: u64,
944}
945
946/// Returns search results from given 'fromIndex' to given 'toIndex' from the search with the given
947/// identifier.
948
949#[derive(Debug, Clone, Serialize, Deserialize, Default)]
950#[serde(rename_all = "camelCase")]
951pub struct GetSearchResultsReturns {
952    /// Ids of the search result nodes.
953
954    pub nodeIds: Vec<NodeId>,
955}
956
957impl GetSearchResultsParams { pub const METHOD: &'static str = "DOM.getSearchResults"; }
958
959impl crate::CdpCommand for GetSearchResultsParams {
960    const METHOD: &'static str = "DOM.getSearchResults";
961    type Response = GetSearchResultsReturns;
962}
963
964#[derive(Debug, Clone, Serialize, Deserialize, Default)]
965pub struct HideHighlightParams {}
966
967impl HideHighlightParams { pub const METHOD: &'static str = "DOM.hideHighlight"; }
968
969impl crate::CdpCommand for HideHighlightParams {
970    const METHOD: &'static str = "DOM.hideHighlight";
971    type Response = crate::EmptyReturns;
972}
973
974#[derive(Debug, Clone, Serialize, Deserialize, Default)]
975pub struct HighlightNodeParams {}
976
977impl HighlightNodeParams { pub const METHOD: &'static str = "DOM.highlightNode"; }
978
979impl crate::CdpCommand for HighlightNodeParams {
980    const METHOD: &'static str = "DOM.highlightNode";
981    type Response = crate::EmptyReturns;
982}
983
984#[derive(Debug, Clone, Serialize, Deserialize, Default)]
985pub struct HighlightRectParams {}
986
987impl HighlightRectParams { pub const METHOD: &'static str = "DOM.highlightRect"; }
988
989impl crate::CdpCommand for HighlightRectParams {
990    const METHOD: &'static str = "DOM.highlightRect";
991    type Response = crate::EmptyReturns;
992}
993
994#[derive(Debug, Clone, Serialize, Deserialize, Default)]
995pub struct MarkUndoableStateParams {}
996
997impl MarkUndoableStateParams { pub const METHOD: &'static str = "DOM.markUndoableState"; }
998
999impl crate::CdpCommand for MarkUndoableStateParams {
1000    const METHOD: &'static str = "DOM.markUndoableState";
1001    type Response = crate::EmptyReturns;
1002}
1003
1004/// Moves node into the new container, places it before the given anchor.
1005
1006#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1007#[serde(rename_all = "camelCase")]
1008pub struct MoveToParams {
1009    /// Id of the node to move.
1010
1011    pub nodeId: NodeId,
1012    /// Id of the element to drop the moved node into.
1013
1014    pub targetNodeId: NodeId,
1015    /// Drop node before this one (if absent, the moved node becomes the last child of
1016    /// 'targetNodeId').
1017
1018    #[serde(skip_serializing_if = "Option::is_none")]
1019    pub insertBeforeNodeId: Option<NodeId>,
1020}
1021
1022/// Moves node into the new container, places it before the given anchor.
1023
1024#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1025#[serde(rename_all = "camelCase")]
1026pub struct MoveToReturns {
1027    /// New id of the moved node.
1028
1029    pub nodeId: NodeId,
1030}
1031
1032impl MoveToParams { pub const METHOD: &'static str = "DOM.moveTo"; }
1033
1034impl crate::CdpCommand for MoveToParams {
1035    const METHOD: &'static str = "DOM.moveTo";
1036    type Response = MoveToReturns;
1037}
1038
1039/// Searches for a given string in the DOM tree. Use 'getSearchResults' to access search results or
1040/// 'cancelSearch' to end this search session.
1041
1042#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1043#[serde(rename_all = "camelCase")]
1044pub struct PerformSearchParams {
1045    /// Plain text or query selector or XPath search query.
1046
1047    pub query: String,
1048    /// True to search in user agent shadow DOM.
1049
1050    #[serde(skip_serializing_if = "Option::is_none")]
1051    pub includeUserAgentShadowDOM: Option<bool>,
1052}
1053
1054/// Searches for a given string in the DOM tree. Use 'getSearchResults' to access search results or
1055/// 'cancelSearch' to end this search session.
1056
1057#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1058#[serde(rename_all = "camelCase")]
1059pub struct PerformSearchReturns {
1060    /// Unique search session identifier.
1061
1062    pub searchId: String,
1063    /// Number of search results.
1064
1065    pub resultCount: u64,
1066}
1067
1068impl PerformSearchParams { pub const METHOD: &'static str = "DOM.performSearch"; }
1069
1070impl crate::CdpCommand for PerformSearchParams {
1071    const METHOD: &'static str = "DOM.performSearch";
1072    type Response = PerformSearchReturns;
1073}
1074
1075/// Requests that the node is sent to the caller given its path. // FIXME, use XPath
1076
1077#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1078#[serde(rename_all = "camelCase")]
1079pub struct PushNodeByPathToFrontendParams {
1080    /// Path to node in the proprietary format.
1081
1082    pub path: String,
1083}
1084
1085/// Requests that the node is sent to the caller given its path. // FIXME, use XPath
1086
1087#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1088#[serde(rename_all = "camelCase")]
1089pub struct PushNodeByPathToFrontendReturns {
1090    /// Id of the node for given path.
1091
1092    pub nodeId: NodeId,
1093}
1094
1095impl PushNodeByPathToFrontendParams { pub const METHOD: &'static str = "DOM.pushNodeByPathToFrontend"; }
1096
1097impl crate::CdpCommand for PushNodeByPathToFrontendParams {
1098    const METHOD: &'static str = "DOM.pushNodeByPathToFrontend";
1099    type Response = PushNodeByPathToFrontendReturns;
1100}
1101
1102/// Requests that a batch of nodes is sent to the caller given their backend node ids.
1103
1104#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1105#[serde(rename_all = "camelCase")]
1106pub struct PushNodesByBackendIdsToFrontendParams {
1107    /// The array of backend node ids.
1108
1109    pub backendNodeIds: Vec<BackendNodeId>,
1110}
1111
1112/// Requests that a batch of nodes is sent to the caller given their backend node ids.
1113
1114#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1115#[serde(rename_all = "camelCase")]
1116pub struct PushNodesByBackendIdsToFrontendReturns {
1117    /// The array of ids of pushed nodes that correspond to the backend ids specified in
1118    /// backendNodeIds.
1119
1120    pub nodeIds: Vec<NodeId>,
1121}
1122
1123impl PushNodesByBackendIdsToFrontendParams { pub const METHOD: &'static str = "DOM.pushNodesByBackendIdsToFrontend"; }
1124
1125impl crate::CdpCommand for PushNodesByBackendIdsToFrontendParams {
1126    const METHOD: &'static str = "DOM.pushNodesByBackendIdsToFrontend";
1127    type Response = PushNodesByBackendIdsToFrontendReturns;
1128}
1129
1130/// Executes 'querySelector' on a given node.
1131
1132#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1133#[serde(rename_all = "camelCase")]
1134pub struct QuerySelectorParams {
1135    /// Id of the node to query upon.
1136
1137    pub nodeId: NodeId,
1138    /// Selector string.
1139
1140    pub selector: String,
1141}
1142
1143/// Executes 'querySelector' on a given node.
1144
1145#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1146#[serde(rename_all = "camelCase")]
1147pub struct QuerySelectorReturns {
1148    /// Query selector result.
1149
1150    pub nodeId: NodeId,
1151}
1152
1153impl QuerySelectorParams { pub const METHOD: &'static str = "DOM.querySelector"; }
1154
1155impl crate::CdpCommand for QuerySelectorParams {
1156    const METHOD: &'static str = "DOM.querySelector";
1157    type Response = QuerySelectorReturns;
1158}
1159
1160/// Executes 'querySelectorAll' on a given node.
1161
1162#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1163#[serde(rename_all = "camelCase")]
1164pub struct QuerySelectorAllParams {
1165    /// Id of the node to query upon.
1166
1167    pub nodeId: NodeId,
1168    /// Selector string.
1169
1170    pub selector: String,
1171}
1172
1173/// Executes 'querySelectorAll' on a given node.
1174
1175#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1176#[serde(rename_all = "camelCase")]
1177pub struct QuerySelectorAllReturns {
1178    /// Query selector result.
1179
1180    pub nodeIds: Vec<NodeId>,
1181}
1182
1183impl QuerySelectorAllParams { pub const METHOD: &'static str = "DOM.querySelectorAll"; }
1184
1185impl crate::CdpCommand for QuerySelectorAllParams {
1186    const METHOD: &'static str = "DOM.querySelectorAll";
1187    type Response = QuerySelectorAllReturns;
1188}
1189
1190/// Returns NodeIds of current top layer elements.
1191/// Top layer is rendered closest to the user within a viewport, therefore its elements always
1192/// appear on top of all other content.
1193
1194#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1195#[serde(rename_all = "camelCase")]
1196pub struct GetTopLayerElementsReturns {
1197    /// NodeIds of top layer elements
1198
1199    pub nodeIds: Vec<NodeId>,
1200}
1201
1202#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1203pub struct GetTopLayerElementsParams {}
1204
1205impl GetTopLayerElementsParams { pub const METHOD: &'static str = "DOM.getTopLayerElements"; }
1206
1207impl crate::CdpCommand for GetTopLayerElementsParams {
1208    const METHOD: &'static str = "DOM.getTopLayerElements";
1209    type Response = GetTopLayerElementsReturns;
1210}
1211
1212/// Returns the NodeId of the matched element according to certain relations.
1213
1214#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1215#[serde(rename_all = "camelCase")]
1216pub struct GetElementByRelationParams {
1217    /// Id of the node from which to query the relation.
1218
1219    pub nodeId: NodeId,
1220    /// Type of relation to get.
1221
1222    pub relation: String,
1223}
1224
1225/// Returns the NodeId of the matched element according to certain relations.
1226
1227#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1228#[serde(rename_all = "camelCase")]
1229pub struct GetElementByRelationReturns {
1230    /// NodeId of the element matching the queried relation.
1231
1232    pub nodeId: NodeId,
1233}
1234
1235impl GetElementByRelationParams { pub const METHOD: &'static str = "DOM.getElementByRelation"; }
1236
1237impl crate::CdpCommand for GetElementByRelationParams {
1238    const METHOD: &'static str = "DOM.getElementByRelation";
1239    type Response = GetElementByRelationReturns;
1240}
1241
1242#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1243pub struct RedoParams {}
1244
1245impl RedoParams { pub const METHOD: &'static str = "DOM.redo"; }
1246
1247impl crate::CdpCommand for RedoParams {
1248    const METHOD: &'static str = "DOM.redo";
1249    type Response = crate::EmptyReturns;
1250}
1251
1252/// Removes attribute with given name from an element with given id.
1253
1254#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1255#[serde(rename_all = "camelCase")]
1256pub struct RemoveAttributeParams {
1257    /// Id of the element to remove attribute from.
1258
1259    pub nodeId: NodeId,
1260    /// Name of the attribute to remove.
1261
1262    pub name: String,
1263}
1264
1265impl RemoveAttributeParams { pub const METHOD: &'static str = "DOM.removeAttribute"; }
1266
1267impl crate::CdpCommand for RemoveAttributeParams {
1268    const METHOD: &'static str = "DOM.removeAttribute";
1269    type Response = crate::EmptyReturns;
1270}
1271
1272/// Removes node with given id.
1273
1274#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1275#[serde(rename_all = "camelCase")]
1276pub struct RemoveNodeParams {
1277    /// Id of the node to remove.
1278
1279    pub nodeId: NodeId,
1280}
1281
1282impl RemoveNodeParams { pub const METHOD: &'static str = "DOM.removeNode"; }
1283
1284impl crate::CdpCommand for RemoveNodeParams {
1285    const METHOD: &'static str = "DOM.removeNode";
1286    type Response = crate::EmptyReturns;
1287}
1288
1289/// Requests that children of the node with given id are returned to the caller in form of
1290/// 'setChildNodes' events where not only immediate children are retrieved, but all children down to
1291/// the specified depth.
1292
1293#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1294#[serde(rename_all = "camelCase")]
1295pub struct RequestChildNodesParams {
1296    /// Id of the node to get children for.
1297
1298    pub nodeId: NodeId,
1299    /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
1300    /// entire subtree or provide an integer larger than 0.
1301
1302    #[serde(skip_serializing_if = "Option::is_none")]
1303    pub depth: Option<i64>,
1304    /// Whether or not iframes and shadow roots should be traversed when returning the sub-tree
1305    /// (default is false).
1306
1307    #[serde(skip_serializing_if = "Option::is_none")]
1308    pub pierce: Option<bool>,
1309}
1310
1311impl RequestChildNodesParams { pub const METHOD: &'static str = "DOM.requestChildNodes"; }
1312
1313impl crate::CdpCommand for RequestChildNodesParams {
1314    const METHOD: &'static str = "DOM.requestChildNodes";
1315    type Response = crate::EmptyReturns;
1316}
1317
1318/// Requests that the node is sent to the caller given the JavaScript node object reference. All
1319/// nodes that form the path from the node to the root are also sent to the client as a series of
1320/// 'setChildNodes' notifications.
1321
1322#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1323#[serde(rename_all = "camelCase")]
1324pub struct RequestNodeParams {
1325    /// JavaScript object id to convert into node.
1326
1327    pub objectId: crate::runtime::RemoteObjectId,
1328}
1329
1330/// Requests that the node is sent to the caller given the JavaScript node object reference. All
1331/// nodes that form the path from the node to the root are also sent to the client as a series of
1332/// 'setChildNodes' notifications.
1333
1334#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1335#[serde(rename_all = "camelCase")]
1336pub struct RequestNodeReturns {
1337    /// Node id for given object.
1338
1339    pub nodeId: NodeId,
1340}
1341
1342impl RequestNodeParams { pub const METHOD: &'static str = "DOM.requestNode"; }
1343
1344impl crate::CdpCommand for RequestNodeParams {
1345    const METHOD: &'static str = "DOM.requestNode";
1346    type Response = RequestNodeReturns;
1347}
1348
1349/// Resolves the JavaScript node object for a given NodeId or BackendNodeId.
1350
1351#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1352#[serde(rename_all = "camelCase")]
1353pub struct ResolveNodeParams {
1354    /// Id of the node to resolve.
1355
1356    #[serde(skip_serializing_if = "Option::is_none")]
1357    pub nodeId: Option<NodeId>,
1358    /// Backend identifier of the node to resolve.
1359
1360    #[serde(skip_serializing_if = "Option::is_none")]
1361    pub backendNodeId: Option<crate::dom::BackendNodeId>,
1362    /// Symbolic group name that can be used to release multiple objects.
1363
1364    #[serde(skip_serializing_if = "Option::is_none")]
1365    pub objectGroup: Option<String>,
1366    /// Execution context in which to resolve the node.
1367
1368    #[serde(skip_serializing_if = "Option::is_none")]
1369    pub executionContextId: Option<crate::runtime::ExecutionContextId>,
1370}
1371
1372/// Resolves the JavaScript node object for a given NodeId or BackendNodeId.
1373
1374#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1375#[serde(rename_all = "camelCase")]
1376pub struct ResolveNodeReturns {
1377    /// JavaScript object wrapper for given node.
1378
1379    pub object: crate::runtime::RemoteObject,
1380}
1381
1382impl ResolveNodeParams { pub const METHOD: &'static str = "DOM.resolveNode"; }
1383
1384impl crate::CdpCommand for ResolveNodeParams {
1385    const METHOD: &'static str = "DOM.resolveNode";
1386    type Response = ResolveNodeReturns;
1387}
1388
1389/// Sets attribute for an element with given id.
1390
1391#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1392#[serde(rename_all = "camelCase")]
1393pub struct SetAttributeValueParams {
1394    /// Id of the element to set attribute for.
1395
1396    pub nodeId: NodeId,
1397    /// Attribute name.
1398
1399    pub name: String,
1400    /// Attribute value.
1401
1402    pub value: String,
1403}
1404
1405impl SetAttributeValueParams { pub const METHOD: &'static str = "DOM.setAttributeValue"; }
1406
1407impl crate::CdpCommand for SetAttributeValueParams {
1408    const METHOD: &'static str = "DOM.setAttributeValue";
1409    type Response = crate::EmptyReturns;
1410}
1411
1412/// Sets attributes on element with given id. This method is useful when user edits some existing
1413/// attribute value and types in several attribute name/value pairs.
1414
1415#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1416#[serde(rename_all = "camelCase")]
1417pub struct SetAttributesAsTextParams {
1418    /// Id of the element to set attributes for.
1419
1420    pub nodeId: NodeId,
1421    /// Text with a number of attributes. Will parse this text using HTML parser.
1422
1423    pub text: String,
1424    /// Attribute name to replace with new attributes derived from text in case text parsed
1425    /// successfully.
1426
1427    #[serde(skip_serializing_if = "Option::is_none")]
1428    pub name: Option<String>,
1429}
1430
1431impl SetAttributesAsTextParams { pub const METHOD: &'static str = "DOM.setAttributesAsText"; }
1432
1433impl crate::CdpCommand for SetAttributesAsTextParams {
1434    const METHOD: &'static str = "DOM.setAttributesAsText";
1435    type Response = crate::EmptyReturns;
1436}
1437
1438/// Sets files for the given file input element.
1439
1440#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1441#[serde(rename_all = "camelCase")]
1442pub struct SetFileInputFilesParams {
1443    /// Array of file paths to set.
1444
1445    pub files: Vec<String>,
1446    /// Identifier of the node.
1447
1448    #[serde(skip_serializing_if = "Option::is_none")]
1449    pub nodeId: Option<NodeId>,
1450    /// Identifier of the backend node.
1451
1452    #[serde(skip_serializing_if = "Option::is_none")]
1453    pub backendNodeId: Option<BackendNodeId>,
1454    /// JavaScript object id of the node wrapper.
1455
1456    #[serde(skip_serializing_if = "Option::is_none")]
1457    pub objectId: Option<crate::runtime::RemoteObjectId>,
1458}
1459
1460impl SetFileInputFilesParams { pub const METHOD: &'static str = "DOM.setFileInputFiles"; }
1461
1462impl crate::CdpCommand for SetFileInputFilesParams {
1463    const METHOD: &'static str = "DOM.setFileInputFiles";
1464    type Response = crate::EmptyReturns;
1465}
1466
1467/// Sets if stack traces should be captured for Nodes. See 'Node.getNodeStackTraces'. Default is disabled.
1468
1469#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1470#[serde(rename_all = "camelCase")]
1471pub struct SetNodeStackTracesEnabledParams {
1472    /// Enable or disable.
1473
1474    pub enable: bool,
1475}
1476
1477impl SetNodeStackTracesEnabledParams { pub const METHOD: &'static str = "DOM.setNodeStackTracesEnabled"; }
1478
1479impl crate::CdpCommand for SetNodeStackTracesEnabledParams {
1480    const METHOD: &'static str = "DOM.setNodeStackTracesEnabled";
1481    type Response = crate::EmptyReturns;
1482}
1483
1484/// Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.
1485
1486#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1487#[serde(rename_all = "camelCase")]
1488pub struct GetNodeStackTracesParams {
1489    /// Id of the node to get stack traces for.
1490
1491    pub nodeId: NodeId,
1492}
1493
1494/// Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.
1495
1496#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1497#[serde(rename_all = "camelCase")]
1498pub struct GetNodeStackTracesReturns {
1499    /// Creation stack trace, if available.
1500
1501    #[serde(skip_serializing_if = "Option::is_none")]
1502    pub creation: Option<crate::runtime::StackTrace>,
1503}
1504
1505impl GetNodeStackTracesParams { pub const METHOD: &'static str = "DOM.getNodeStackTraces"; }
1506
1507impl crate::CdpCommand for GetNodeStackTracesParams {
1508    const METHOD: &'static str = "DOM.getNodeStackTraces";
1509    type Response = GetNodeStackTracesReturns;
1510}
1511
1512/// Returns file information for the given
1513/// File wrapper.
1514
1515#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1516#[serde(rename_all = "camelCase")]
1517pub struct GetFileInfoParams {
1518    /// JavaScript object id of the node wrapper.
1519
1520    pub objectId: crate::runtime::RemoteObjectId,
1521}
1522
1523/// Returns file information for the given
1524/// File wrapper.
1525
1526#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1527#[serde(rename_all = "camelCase")]
1528pub struct GetFileInfoReturns {
1529
1530    pub path: String,
1531}
1532
1533impl GetFileInfoParams { pub const METHOD: &'static str = "DOM.getFileInfo"; }
1534
1535impl crate::CdpCommand for GetFileInfoParams {
1536    const METHOD: &'static str = "DOM.getFileInfo";
1537    type Response = GetFileInfoReturns;
1538}
1539
1540/// Returns list of detached nodes
1541
1542#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1543#[serde(rename_all = "camelCase")]
1544pub struct GetDetachedDomNodesReturns {
1545    /// The list of detached nodes
1546
1547    pub detachedNodes: Vec<DetachedElementInfo>,
1548}
1549
1550#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1551pub struct GetDetachedDomNodesParams {}
1552
1553impl GetDetachedDomNodesParams { pub const METHOD: &'static str = "DOM.getDetachedDomNodes"; }
1554
1555impl crate::CdpCommand for GetDetachedDomNodesParams {
1556    const METHOD: &'static str = "DOM.getDetachedDomNodes";
1557    type Response = GetDetachedDomNodesReturns;
1558}
1559
1560/// Enables console to refer to the node with given id via $x (see Command Line API for more details
1561/// $x functions).
1562
1563#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1564#[serde(rename_all = "camelCase")]
1565pub struct SetInspectedNodeParams {
1566    /// DOM node id to be accessible by means of $x command line API.
1567
1568    pub nodeId: NodeId,
1569}
1570
1571impl SetInspectedNodeParams { pub const METHOD: &'static str = "DOM.setInspectedNode"; }
1572
1573impl crate::CdpCommand for SetInspectedNodeParams {
1574    const METHOD: &'static str = "DOM.setInspectedNode";
1575    type Response = crate::EmptyReturns;
1576}
1577
1578/// Sets node name for a node with given id.
1579
1580#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1581#[serde(rename_all = "camelCase")]
1582pub struct SetNodeNameParams {
1583    /// Id of the node to set name for.
1584
1585    pub nodeId: NodeId,
1586    /// New node's name.
1587
1588    pub name: String,
1589}
1590
1591/// Sets node name for a node with given id.
1592
1593#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1594#[serde(rename_all = "camelCase")]
1595pub struct SetNodeNameReturns {
1596    /// New node's id.
1597
1598    pub nodeId: NodeId,
1599}
1600
1601impl SetNodeNameParams { pub const METHOD: &'static str = "DOM.setNodeName"; }
1602
1603impl crate::CdpCommand for SetNodeNameParams {
1604    const METHOD: &'static str = "DOM.setNodeName";
1605    type Response = SetNodeNameReturns;
1606}
1607
1608/// Sets node value for a node with given id.
1609
1610#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1611#[serde(rename_all = "camelCase")]
1612pub struct SetNodeValueParams {
1613    /// Id of the node to set value for.
1614
1615    pub nodeId: NodeId,
1616    /// New node's value.
1617
1618    pub value: String,
1619}
1620
1621impl SetNodeValueParams { pub const METHOD: &'static str = "DOM.setNodeValue"; }
1622
1623impl crate::CdpCommand for SetNodeValueParams {
1624    const METHOD: &'static str = "DOM.setNodeValue";
1625    type Response = crate::EmptyReturns;
1626}
1627
1628/// Sets node HTML markup, returns new node id.
1629
1630#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1631#[serde(rename_all = "camelCase")]
1632pub struct SetOuterHTMLParams {
1633    /// Id of the node to set markup for.
1634
1635    pub nodeId: NodeId,
1636    /// Outer HTML markup to set.
1637
1638    pub outerHTML: String,
1639}
1640
1641impl SetOuterHTMLParams { pub const METHOD: &'static str = "DOM.setOuterHTML"; }
1642
1643impl crate::CdpCommand for SetOuterHTMLParams {
1644    const METHOD: &'static str = "DOM.setOuterHTML";
1645    type Response = crate::EmptyReturns;
1646}
1647
1648#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1649pub struct UndoParams {}
1650
1651impl UndoParams { pub const METHOD: &'static str = "DOM.undo"; }
1652
1653impl crate::CdpCommand for UndoParams {
1654    const METHOD: &'static str = "DOM.undo";
1655    type Response = crate::EmptyReturns;
1656}
1657
1658/// Returns iframe node that owns iframe with the given domain.
1659
1660#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1661#[serde(rename_all = "camelCase")]
1662pub struct GetFrameOwnerParams {
1663
1664    pub frameId: crate::page::FrameId,
1665}
1666
1667/// Returns iframe node that owns iframe with the given domain.
1668
1669#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1670#[serde(rename_all = "camelCase")]
1671pub struct GetFrameOwnerReturns {
1672    /// Resulting node.
1673
1674    pub backendNodeId: BackendNodeId,
1675    /// Id of the node at given coordinates, only when enabled and requested document.
1676
1677    #[serde(skip_serializing_if = "Option::is_none")]
1678    pub nodeId: Option<NodeId>,
1679}
1680
1681impl GetFrameOwnerParams { pub const METHOD: &'static str = "DOM.getFrameOwner"; }
1682
1683impl crate::CdpCommand for GetFrameOwnerParams {
1684    const METHOD: &'static str = "DOM.getFrameOwner";
1685    type Response = GetFrameOwnerReturns;
1686}
1687
1688/// Returns the query container of the given node based on container query
1689/// conditions: containerName, physical and logical axes, and whether it queries
1690/// scroll-state or anchored elements. If no axes are provided and
1691/// queriesScrollState is false, the style container is returned, which is the
1692/// direct parent or the closest element with a matching container-name.
1693
1694#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1695#[serde(rename_all = "camelCase")]
1696pub struct GetContainerForNodeParams {
1697
1698    pub nodeId: NodeId,
1699
1700    #[serde(skip_serializing_if = "Option::is_none")]
1701    pub containerName: Option<String>,
1702
1703    #[serde(skip_serializing_if = "Option::is_none")]
1704    pub physicalAxes: Option<PhysicalAxes>,
1705
1706    #[serde(skip_serializing_if = "Option::is_none")]
1707    pub logicalAxes: Option<LogicalAxes>,
1708
1709    #[serde(skip_serializing_if = "Option::is_none")]
1710    pub queriesScrollState: Option<bool>,
1711
1712    #[serde(skip_serializing_if = "Option::is_none")]
1713    pub queriesAnchored: Option<bool>,
1714}
1715
1716/// Returns the query container of the given node based on container query
1717/// conditions: containerName, physical and logical axes, and whether it queries
1718/// scroll-state or anchored elements. If no axes are provided and
1719/// queriesScrollState is false, the style container is returned, which is the
1720/// direct parent or the closest element with a matching container-name.
1721
1722#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1723#[serde(rename_all = "camelCase")]
1724pub struct GetContainerForNodeReturns {
1725    /// The container node for the given node, or null if not found.
1726
1727    #[serde(skip_serializing_if = "Option::is_none")]
1728    pub nodeId: Option<NodeId>,
1729}
1730
1731impl GetContainerForNodeParams { pub const METHOD: &'static str = "DOM.getContainerForNode"; }
1732
1733impl crate::CdpCommand for GetContainerForNodeParams {
1734    const METHOD: &'static str = "DOM.getContainerForNode";
1735    type Response = GetContainerForNodeReturns;
1736}
1737
1738/// Returns the descendants of a container query container that have
1739/// container queries against this container.
1740
1741#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1742#[serde(rename_all = "camelCase")]
1743pub struct GetQueryingDescendantsForContainerParams {
1744    /// Id of the container node to find querying descendants from.
1745
1746    pub nodeId: NodeId,
1747}
1748
1749/// Returns the descendants of a container query container that have
1750/// container queries against this container.
1751
1752#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1753#[serde(rename_all = "camelCase")]
1754pub struct GetQueryingDescendantsForContainerReturns {
1755    /// Descendant nodes with container queries against the given container.
1756
1757    pub nodeIds: Vec<NodeId>,
1758}
1759
1760impl GetQueryingDescendantsForContainerParams { pub const METHOD: &'static str = "DOM.getQueryingDescendantsForContainer"; }
1761
1762impl crate::CdpCommand for GetQueryingDescendantsForContainerParams {
1763    const METHOD: &'static str = "DOM.getQueryingDescendantsForContainer";
1764    type Response = GetQueryingDescendantsForContainerReturns;
1765}
1766
1767/// Returns the target anchor element of the given anchor query according to
1768/// https://www.w3.org/TR/css-anchor-position-1/#target.
1769
1770#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1771#[serde(rename_all = "camelCase")]
1772pub struct GetAnchorElementParams {
1773    /// Id of the positioned element from which to find the anchor.
1774
1775    pub nodeId: NodeId,
1776    /// An optional anchor specifier, as defined in
1777    /// https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier.
1778    /// If not provided, it will return the implicit anchor element for
1779    /// the given positioned element.
1780
1781    #[serde(skip_serializing_if = "Option::is_none")]
1782    pub anchorSpecifier: Option<String>,
1783}
1784
1785/// Returns the target anchor element of the given anchor query according to
1786/// https://www.w3.org/TR/css-anchor-position-1/#target.
1787
1788#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1789#[serde(rename_all = "camelCase")]
1790pub struct GetAnchorElementReturns {
1791    /// The anchor element of the given anchor query.
1792
1793    pub nodeId: NodeId,
1794}
1795
1796impl GetAnchorElementParams { pub const METHOD: &'static str = "DOM.getAnchorElement"; }
1797
1798impl crate::CdpCommand for GetAnchorElementParams {
1799    const METHOD: &'static str = "DOM.getAnchorElement";
1800    type Response = GetAnchorElementReturns;
1801}
1802
1803/// When enabling, this API force-opens the popover identified by nodeId
1804/// and keeps it open until disabled.
1805
1806#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1807#[serde(rename_all = "camelCase")]
1808pub struct ForceShowPopoverParams {
1809    /// Id of the popover HTMLElement
1810
1811    pub nodeId: NodeId,
1812    /// If true, opens the popover and keeps it open. If false, closes the
1813    /// popover if it was previously force-opened.
1814
1815    pub enable: bool,
1816}
1817
1818/// When enabling, this API force-opens the popover identified by nodeId
1819/// and keeps it open until disabled.
1820
1821#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1822#[serde(rename_all = "camelCase")]
1823pub struct ForceShowPopoverReturns {
1824    /// List of popovers that were closed in order to respect popover stacking order.
1825
1826    pub nodeIds: Vec<NodeId>,
1827}
1828
1829impl ForceShowPopoverParams { pub const METHOD: &'static str = "DOM.forceShowPopover"; }
1830
1831impl crate::CdpCommand for ForceShowPopoverParams {
1832    const METHOD: &'static str = "DOM.forceShowPopover";
1833    type Response = ForceShowPopoverReturns;
1834}