Skip to main content

browser_protocol/accessibility/
mod.rs

1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5/// Unique accessibility node identifier.
6
7pub type AXNodeId<'a> = Cow<'a, str>;
8
9/// Enum of possible property types.
10
11#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
12pub enum AXValueType {
13    #[default]
14    #[serde(rename = "boolean")]
15    Boolean,
16    #[serde(rename = "tristate")]
17    Tristate,
18    #[serde(rename = "booleanOrUndefined")]
19    BooleanOrUndefined,
20    #[serde(rename = "idref")]
21    Idref,
22    #[serde(rename = "idrefList")]
23    IdrefList,
24    #[serde(rename = "integer")]
25    Integer,
26    #[serde(rename = "node")]
27    Node,
28    #[serde(rename = "nodeList")]
29    NodeList,
30    #[serde(rename = "number")]
31    Number,
32    #[serde(rename = "string")]
33    String,
34    #[serde(rename = "computedString")]
35    ComputedString,
36    #[serde(rename = "token")]
37    Token,
38    #[serde(rename = "tokenList")]
39    TokenList,
40    #[serde(rename = "domRelation")]
41    DomRelation,
42    #[serde(rename = "role")]
43    Role,
44    #[serde(rename = "internalRole")]
45    InternalRole,
46    #[serde(rename = "valueUndefined")]
47    ValueUndefined,
48}
49
50/// Enum of possible property sources.
51
52#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
53pub enum AXValueSourceType {
54    #[default]
55    #[serde(rename = "attribute")]
56    Attribute,
57    #[serde(rename = "implicit")]
58    Implicit,
59    #[serde(rename = "style")]
60    Style,
61    #[serde(rename = "contents")]
62    Contents,
63    #[serde(rename = "placeholder")]
64    Placeholder,
65    #[serde(rename = "relatedElement")]
66    RelatedElement,
67}
68
69/// Enum of possible native property sources (as a subtype of a particular AXValueSourceType).
70
71#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
72pub enum AXValueNativeSourceType {
73    #[default]
74    #[serde(rename = "description")]
75    Description,
76    #[serde(rename = "figcaption")]
77    Figcaption,
78    #[serde(rename = "label")]
79    Label,
80    #[serde(rename = "labelfor")]
81    Labelfor,
82    #[serde(rename = "labelwrapped")]
83    Labelwrapped,
84    #[serde(rename = "legend")]
85    Legend,
86    #[serde(rename = "rubyannotation")]
87    Rubyannotation,
88    #[serde(rename = "tablecaption")]
89    Tablecaption,
90    #[serde(rename = "title")]
91    Title,
92    #[serde(rename = "other")]
93    Other,
94}
95
96/// A single source for a computed AX property.
97
98#[derive(Debug, Clone, Serialize, Deserialize, Default)]
99#[serde(rename_all = "camelCase")]
100pub struct AXValueSource<'a> {
101    /// What type of source this is.
102    #[serde(rename = "type")]
103    type_: AXValueSourceType,
104    /// The value of this property source.
105    #[serde(skip_serializing_if = "Option::is_none")]
106    value: Option<AXValue<'a>>,
107    /// The name of the relevant attribute, if any.
108    #[serde(skip_serializing_if = "Option::is_none")]
109    attribute: Option<Cow<'a, str>>,
110    /// The value of the relevant attribute, if any.
111    #[serde(skip_serializing_if = "Option::is_none")]
112    attributeValue: Option<AXValue<'a>>,
113    /// Whether this source is superseded by a higher priority source.
114    #[serde(skip_serializing_if = "Option::is_none")]
115    superseded: Option<bool>,
116    /// The native markup source for this value, e.g. a '<label>' element.
117    #[serde(skip_serializing_if = "Option::is_none")]
118    nativeSource: Option<AXValueNativeSourceType>,
119    /// The value, such as a node or node list, of the native source.
120    #[serde(skip_serializing_if = "Option::is_none")]
121    nativeSourceValue: Option<AXValue<'a>>,
122    /// Whether the value for this property is invalid.
123    #[serde(skip_serializing_if = "Option::is_none")]
124    invalid: Option<bool>,
125    /// Reason for the value being invalid, if it is.
126    #[serde(skip_serializing_if = "Option::is_none")]
127    invalidReason: Option<Cow<'a, str>>,
128}
129
130impl<'a> AXValueSource<'a> {
131    pub fn builder(type_: AXValueSourceType) -> AXValueSourceBuilder<'a> {
132        AXValueSourceBuilder {
133            type_: type_,
134            value: None,
135            attribute: None,
136            attributeValue: None,
137            superseded: None,
138            nativeSource: None,
139            nativeSourceValue: None,
140            invalid: None,
141            invalidReason: None,
142        }
143    }
144    pub fn type_(&self) -> &AXValueSourceType { &self.type_ }
145    pub fn value(&self) -> Option<&AXValue<'a>> { self.value.as_ref() }
146    pub fn attribute(&self) -> Option<&str> { self.attribute.as_deref() }
147    pub fn attributeValue(&self) -> Option<&AXValue<'a>> { self.attributeValue.as_ref() }
148    pub fn superseded(&self) -> Option<bool> { self.superseded }
149    pub fn nativeSource(&self) -> Option<&AXValueNativeSourceType> { self.nativeSource.as_ref() }
150    pub fn nativeSourceValue(&self) -> Option<&AXValue<'a>> { self.nativeSourceValue.as_ref() }
151    pub fn invalid(&self) -> Option<bool> { self.invalid }
152    pub fn invalidReason(&self) -> Option<&str> { self.invalidReason.as_deref() }
153}
154
155
156pub struct AXValueSourceBuilder<'a> {
157    type_: AXValueSourceType,
158    value: Option<AXValue<'a>>,
159    attribute: Option<Cow<'a, str>>,
160    attributeValue: Option<AXValue<'a>>,
161    superseded: Option<bool>,
162    nativeSource: Option<AXValueNativeSourceType>,
163    nativeSourceValue: Option<AXValue<'a>>,
164    invalid: Option<bool>,
165    invalidReason: Option<Cow<'a, str>>,
166}
167
168impl<'a> AXValueSourceBuilder<'a> {
169    /// The value of this property source.
170    pub fn value(mut self, value: AXValue<'a>) -> Self { self.value = Some(value); self }
171    /// The name of the relevant attribute, if any.
172    pub fn attribute(mut self, attribute: impl Into<Cow<'a, str>>) -> Self { self.attribute = Some(attribute.into()); self }
173    /// The value of the relevant attribute, if any.
174    pub fn attributeValue(mut self, attributeValue: AXValue<'a>) -> Self { self.attributeValue = Some(attributeValue); self }
175    /// Whether this source is superseded by a higher priority source.
176    pub fn superseded(mut self, superseded: bool) -> Self { self.superseded = Some(superseded); self }
177    /// The native markup source for this value, e.g. a '<label>' element.
178    pub fn nativeSource(mut self, nativeSource: AXValueNativeSourceType) -> Self { self.nativeSource = Some(nativeSource); self }
179    /// The value, such as a node or node list, of the native source.
180    pub fn nativeSourceValue(mut self, nativeSourceValue: AXValue<'a>) -> Self { self.nativeSourceValue = Some(nativeSourceValue); self }
181    /// Whether the value for this property is invalid.
182    pub fn invalid(mut self, invalid: bool) -> Self { self.invalid = Some(invalid); self }
183    /// Reason for the value being invalid, if it is.
184    pub fn invalidReason(mut self, invalidReason: impl Into<Cow<'a, str>>) -> Self { self.invalidReason = Some(invalidReason.into()); self }
185    pub fn build(self) -> AXValueSource<'a> {
186        AXValueSource {
187            type_: self.type_,
188            value: self.value,
189            attribute: self.attribute,
190            attributeValue: self.attributeValue,
191            superseded: self.superseded,
192            nativeSource: self.nativeSource,
193            nativeSourceValue: self.nativeSourceValue,
194            invalid: self.invalid,
195            invalidReason: self.invalidReason,
196        }
197    }
198}
199
200
201#[derive(Debug, Clone, Serialize, Deserialize, Default)]
202#[serde(rename_all = "camelCase")]
203pub struct AXRelatedNode<'a> {
204    /// The BackendNodeId of the related DOM node.
205    backendDOMNodeId: crate::dom::BackendNodeId,
206    /// The IDRef value provided, if any.
207    #[serde(skip_serializing_if = "Option::is_none")]
208    idref: Option<Cow<'a, str>>,
209    /// The text alternative of this node in the current context.
210    #[serde(skip_serializing_if = "Option::is_none")]
211    text: Option<Cow<'a, str>>,
212}
213
214impl<'a> AXRelatedNode<'a> {
215    pub fn builder(backendDOMNodeId: crate::dom::BackendNodeId) -> AXRelatedNodeBuilder<'a> {
216        AXRelatedNodeBuilder {
217            backendDOMNodeId: backendDOMNodeId,
218            idref: None,
219            text: None,
220        }
221    }
222    pub fn backendDOMNodeId(&self) -> &crate::dom::BackendNodeId { &self.backendDOMNodeId }
223    pub fn idref(&self) -> Option<&str> { self.idref.as_deref() }
224    pub fn text(&self) -> Option<&str> { self.text.as_deref() }
225}
226
227
228pub struct AXRelatedNodeBuilder<'a> {
229    backendDOMNodeId: crate::dom::BackendNodeId,
230    idref: Option<Cow<'a, str>>,
231    text: Option<Cow<'a, str>>,
232}
233
234impl<'a> AXRelatedNodeBuilder<'a> {
235    /// The IDRef value provided, if any.
236    pub fn idref(mut self, idref: impl Into<Cow<'a, str>>) -> Self { self.idref = Some(idref.into()); self }
237    /// The text alternative of this node in the current context.
238    pub fn text(mut self, text: impl Into<Cow<'a, str>>) -> Self { self.text = Some(text.into()); self }
239    pub fn build(self) -> AXRelatedNode<'a> {
240        AXRelatedNode {
241            backendDOMNodeId: self.backendDOMNodeId,
242            idref: self.idref,
243            text: self.text,
244        }
245    }
246}
247
248
249#[derive(Debug, Clone, Serialize, Deserialize, Default)]
250#[serde(rename_all = "camelCase")]
251pub struct AXProperty<'a> {
252    /// The name of this property.
253    name: AXPropertyName,
254    /// The value of this property.
255    value: AXValue<'a>,
256}
257
258impl<'a> AXProperty<'a> {
259    pub fn builder(name: AXPropertyName, value: AXValue<'a>) -> AXPropertyBuilder<'a> {
260        AXPropertyBuilder {
261            name: name,
262            value: value,
263        }
264    }
265    pub fn name(&self) -> &AXPropertyName { &self.name }
266    pub fn value(&self) -> &AXValue<'a> { &self.value }
267}
268
269
270pub struct AXPropertyBuilder<'a> {
271    name: AXPropertyName,
272    value: AXValue<'a>,
273}
274
275impl<'a> AXPropertyBuilder<'a> {
276    pub fn build(self) -> AXProperty<'a> {
277        AXProperty {
278            name: self.name,
279            value: self.value,
280        }
281    }
282}
283
284/// A single computed AX property.
285
286#[derive(Debug, Clone, Serialize, Deserialize, Default)]
287#[serde(rename_all = "camelCase")]
288pub struct AXValue<'a> {
289    /// The type of this value.
290    #[serde(rename = "type")]
291    type_: AXValueType,
292    /// The computed value of this property.
293    #[serde(skip_serializing_if = "Option::is_none")]
294    value: Option<JsonValue>,
295    /// One or more related nodes, if applicable.
296    #[serde(skip_serializing_if = "Option::is_none")]
297    relatedNodes: Option<Vec<AXRelatedNode<'a>>>,
298    /// The sources which contributed to the computation of this property.
299    #[serde(skip_serializing_if = "Option::is_none")]
300    sources: Option<Vec<AXValueSource<'a>>>,
301}
302
303impl<'a> AXValue<'a> {
304    pub fn builder(type_: AXValueType) -> AXValueBuilder<'a> {
305        AXValueBuilder {
306            type_: type_,
307            value: None,
308            relatedNodes: None,
309            sources: None,
310        }
311    }
312    pub fn type_(&self) -> &AXValueType { &self.type_ }
313    pub fn value(&self) -> Option<&JsonValue> { self.value.as_ref() }
314    pub fn relatedNodes(&self) -> Option<&[AXRelatedNode<'a>]> { self.relatedNodes.as_deref() }
315    pub fn sources(&self) -> Option<&[AXValueSource<'a>]> { self.sources.as_deref() }
316}
317
318
319pub struct AXValueBuilder<'a> {
320    type_: AXValueType,
321    value: Option<JsonValue>,
322    relatedNodes: Option<Vec<AXRelatedNode<'a>>>,
323    sources: Option<Vec<AXValueSource<'a>>>,
324}
325
326impl<'a> AXValueBuilder<'a> {
327    /// The computed value of this property.
328    pub fn value(mut self, value: JsonValue) -> Self { self.value = Some(value); self }
329    /// One or more related nodes, if applicable.
330    pub fn relatedNodes(mut self, relatedNodes: Vec<AXRelatedNode<'a>>) -> Self { self.relatedNodes = Some(relatedNodes); self }
331    /// The sources which contributed to the computation of this property.
332    pub fn sources(mut self, sources: Vec<AXValueSource<'a>>) -> Self { self.sources = Some(sources); self }
333    pub fn build(self) -> AXValue<'a> {
334        AXValue {
335            type_: self.type_,
336            value: self.value,
337            relatedNodes: self.relatedNodes,
338            sources: self.sources,
339        }
340    }
341}
342
343/// Values of AXProperty name:
344/// - from 'busy' to 'roledescription': states which apply to every AX node
345/// - from 'live' to 'root': attributes which apply to nodes in live regions
346/// - from 'autocomplete' to 'valuetext': attributes which apply to widgets
347/// - from 'checked' to 'selected': states which apply to widgets
348/// - from 'activedescendant' to 'owns': relationships between elements other than parent/child/sibling
349/// - from 'activeFullscreenElement' to 'uninteresting': reasons why this noode is hidden
350
351#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
352pub enum AXPropertyName {
353    #[default]
354    #[serde(rename = "actions")]
355    Actions,
356    #[serde(rename = "busy")]
357    Busy,
358    #[serde(rename = "disabled")]
359    Disabled,
360    #[serde(rename = "editable")]
361    Editable,
362    #[serde(rename = "focusable")]
363    Focusable,
364    #[serde(rename = "focused")]
365    Focused,
366    #[serde(rename = "hidden")]
367    Hidden,
368    #[serde(rename = "hiddenRoot")]
369    HiddenRoot,
370    #[serde(rename = "invalid")]
371    Invalid,
372    #[serde(rename = "keyshortcuts")]
373    Keyshortcuts,
374    #[serde(rename = "settable")]
375    Settable,
376    #[serde(rename = "roledescription")]
377    Roledescription,
378    #[serde(rename = "live")]
379    Live,
380    #[serde(rename = "atomic")]
381    Atomic,
382    #[serde(rename = "relevant")]
383    Relevant,
384    #[serde(rename = "root")]
385    Root,
386    #[serde(rename = "autocomplete")]
387    Autocomplete,
388    #[serde(rename = "hasPopup")]
389    HasPopup,
390    #[serde(rename = "level")]
391    Level,
392    #[serde(rename = "multiselectable")]
393    Multiselectable,
394    #[serde(rename = "orientation")]
395    Orientation,
396    #[serde(rename = "multiline")]
397    Multiline,
398    #[serde(rename = "readonly")]
399    Readonly,
400    #[serde(rename = "required")]
401    Required,
402    #[serde(rename = "valuemin")]
403    Valuemin,
404    #[serde(rename = "valuemax")]
405    Valuemax,
406    #[serde(rename = "valuetext")]
407    Valuetext,
408    #[serde(rename = "checked")]
409    Checked,
410    #[serde(rename = "expanded")]
411    Expanded,
412    #[serde(rename = "modal")]
413    Modal,
414    #[serde(rename = "pressed")]
415    Pressed,
416    #[serde(rename = "selected")]
417    Selected,
418    #[serde(rename = "activedescendant")]
419    Activedescendant,
420    #[serde(rename = "controls")]
421    Controls,
422    #[serde(rename = "describedby")]
423    Describedby,
424    #[serde(rename = "details")]
425    Details,
426    #[serde(rename = "errormessage")]
427    Errormessage,
428    #[serde(rename = "flowto")]
429    Flowto,
430    #[serde(rename = "labelledby")]
431    Labelledby,
432    #[serde(rename = "owns")]
433    Owns,
434    #[serde(rename = "url")]
435    Url,
436    #[serde(rename = "activeFullscreenElement")]
437    ActiveFullscreenElement,
438    #[serde(rename = "activeModalDialog")]
439    ActiveModalDialog,
440    #[serde(rename = "activeAriaModalDialog")]
441    ActiveAriaModalDialog,
442    #[serde(rename = "ariaHiddenElement")]
443    AriaHiddenElement,
444    #[serde(rename = "ariaHiddenSubtree")]
445    AriaHiddenSubtree,
446    #[serde(rename = "emptyAlt")]
447    EmptyAlt,
448    #[serde(rename = "emptyText")]
449    EmptyText,
450    #[serde(rename = "inertElement")]
451    InertElement,
452    #[serde(rename = "inertSubtree")]
453    InertSubtree,
454    #[serde(rename = "labelContainer")]
455    LabelContainer,
456    #[serde(rename = "labelFor")]
457    LabelFor,
458    #[serde(rename = "notRendered")]
459    NotRendered,
460    #[serde(rename = "notVisible")]
461    NotVisible,
462    #[serde(rename = "presentationalRole")]
463    PresentationalRole,
464    #[serde(rename = "probablyPresentational")]
465    ProbablyPresentational,
466    #[serde(rename = "inactiveCarouselTabContent")]
467    InactiveCarouselTabContent,
468    #[serde(rename = "uninteresting")]
469    Uninteresting,
470}
471
472/// A node in the accessibility tree.
473
474#[derive(Debug, Clone, Serialize, Deserialize, Default)]
475#[serde(rename_all = "camelCase")]
476pub struct AXNode<'a> {
477    /// Unique identifier for this node.
478    nodeId: AXNodeId<'a>,
479    /// Whether this node is ignored for accessibility
480    ignored: bool,
481    /// Collection of reasons why this node is hidden.
482    #[serde(skip_serializing_if = "Option::is_none")]
483    ignoredReasons: Option<Vec<AXProperty<'a>>>,
484    /// This 'Node''s role, whether explicit or implicit.
485    #[serde(skip_serializing_if = "Option::is_none")]
486    role: Option<AXValue<'a>>,
487    /// This 'Node''s Chrome raw role.
488    #[serde(skip_serializing_if = "Option::is_none")]
489    chromeRole: Option<AXValue<'a>>,
490    /// The accessible name for this 'Node'.
491    #[serde(skip_serializing_if = "Option::is_none")]
492    name: Option<AXValue<'a>>,
493    /// The accessible description for this 'Node'.
494    #[serde(skip_serializing_if = "Option::is_none")]
495    description: Option<AXValue<'a>>,
496    /// The value for this 'Node'.
497    #[serde(skip_serializing_if = "Option::is_none")]
498    value: Option<AXValue<'a>>,
499    /// All other properties
500    #[serde(skip_serializing_if = "Option::is_none")]
501    properties: Option<Vec<AXProperty<'a>>>,
502    /// ID for this node's parent.
503    #[serde(skip_serializing_if = "Option::is_none")]
504    parentId: Option<AXNodeId<'a>>,
505    /// IDs for each of this node's child nodes.
506    #[serde(skip_serializing_if = "Option::is_none")]
507    childIds: Option<Vec<AXNodeId<'a>>>,
508    /// The backend ID for the associated DOM node, if any.
509    #[serde(skip_serializing_if = "Option::is_none")]
510    backendDOMNodeId: Option<crate::dom::BackendNodeId>,
511    /// The frame ID for the frame associated with this nodes document.
512    #[serde(skip_serializing_if = "Option::is_none")]
513    frameId: Option<crate::page::FrameId<'a>>,
514}
515
516impl<'a> AXNode<'a> {
517    pub fn builder(nodeId: AXNodeId<'a>, ignored: bool) -> AXNodeBuilder<'a> {
518        AXNodeBuilder {
519            nodeId: nodeId,
520            ignored: ignored,
521            ignoredReasons: None,
522            role: None,
523            chromeRole: None,
524            name: None,
525            description: None,
526            value: None,
527            properties: None,
528            parentId: None,
529            childIds: None,
530            backendDOMNodeId: None,
531            frameId: None,
532        }
533    }
534    pub fn nodeId(&self) -> &AXNodeId<'a> { &self.nodeId }
535    pub fn ignored(&self) -> bool { self.ignored }
536    pub fn ignoredReasons(&self) -> Option<&[AXProperty<'a>]> { self.ignoredReasons.as_deref() }
537    pub fn role(&self) -> Option<&AXValue<'a>> { self.role.as_ref() }
538    pub fn chromeRole(&self) -> Option<&AXValue<'a>> { self.chromeRole.as_ref() }
539    pub fn name(&self) -> Option<&AXValue<'a>> { self.name.as_ref() }
540    pub fn description(&self) -> Option<&AXValue<'a>> { self.description.as_ref() }
541    pub fn value(&self) -> Option<&AXValue<'a>> { self.value.as_ref() }
542    pub fn properties(&self) -> Option<&[AXProperty<'a>]> { self.properties.as_deref() }
543    pub fn parentId(&self) -> Option<&AXNodeId<'a>> { self.parentId.as_ref() }
544    pub fn childIds(&self) -> Option<&[AXNodeId<'a>]> { self.childIds.as_deref() }
545    pub fn backendDOMNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.backendDOMNodeId.as_ref() }
546    pub fn frameId(&self) -> Option<&crate::page::FrameId<'a>> { self.frameId.as_ref() }
547}
548
549
550pub struct AXNodeBuilder<'a> {
551    nodeId: AXNodeId<'a>,
552    ignored: bool,
553    ignoredReasons: Option<Vec<AXProperty<'a>>>,
554    role: Option<AXValue<'a>>,
555    chromeRole: Option<AXValue<'a>>,
556    name: Option<AXValue<'a>>,
557    description: Option<AXValue<'a>>,
558    value: Option<AXValue<'a>>,
559    properties: Option<Vec<AXProperty<'a>>>,
560    parentId: Option<AXNodeId<'a>>,
561    childIds: Option<Vec<AXNodeId<'a>>>,
562    backendDOMNodeId: Option<crate::dom::BackendNodeId>,
563    frameId: Option<crate::page::FrameId<'a>>,
564}
565
566impl<'a> AXNodeBuilder<'a> {
567    /// Collection of reasons why this node is hidden.
568    pub fn ignoredReasons(mut self, ignoredReasons: Vec<AXProperty<'a>>) -> Self { self.ignoredReasons = Some(ignoredReasons); self }
569    /// This 'Node''s role, whether explicit or implicit.
570    pub fn role(mut self, role: AXValue<'a>) -> Self { self.role = Some(role); self }
571    /// This 'Node''s Chrome raw role.
572    pub fn chromeRole(mut self, chromeRole: AXValue<'a>) -> Self { self.chromeRole = Some(chromeRole); self }
573    /// The accessible name for this 'Node'.
574    pub fn name(mut self, name: AXValue<'a>) -> Self { self.name = Some(name); self }
575    /// The accessible description for this 'Node'.
576    pub fn description(mut self, description: AXValue<'a>) -> Self { self.description = Some(description); self }
577    /// The value for this 'Node'.
578    pub fn value(mut self, value: AXValue<'a>) -> Self { self.value = Some(value); self }
579    /// All other properties
580    pub fn properties(mut self, properties: Vec<AXProperty<'a>>) -> Self { self.properties = Some(properties); self }
581    /// ID for this node's parent.
582    pub fn parentId(mut self, parentId: AXNodeId<'a>) -> Self { self.parentId = Some(parentId); self }
583    /// IDs for each of this node's child nodes.
584    pub fn childIds(mut self, childIds: Vec<AXNodeId<'a>>) -> Self { self.childIds = Some(childIds); self }
585    /// The backend ID for the associated DOM node, if any.
586    pub fn backendDOMNodeId(mut self, backendDOMNodeId: crate::dom::BackendNodeId) -> Self { self.backendDOMNodeId = Some(backendDOMNodeId); self }
587    /// The frame ID for the frame associated with this nodes document.
588    pub fn frameId(mut self, frameId: crate::page::FrameId<'a>) -> Self { self.frameId = Some(frameId); self }
589    pub fn build(self) -> AXNode<'a> {
590        AXNode {
591            nodeId: self.nodeId,
592            ignored: self.ignored,
593            ignoredReasons: self.ignoredReasons,
594            role: self.role,
595            chromeRole: self.chromeRole,
596            name: self.name,
597            description: self.description,
598            value: self.value,
599            properties: self.properties,
600            parentId: self.parentId,
601            childIds: self.childIds,
602            backendDOMNodeId: self.backendDOMNodeId,
603            frameId: self.frameId,
604        }
605    }
606}
607
608#[derive(Debug, Clone, Serialize, Deserialize, Default)]
609pub struct DisableParams {}
610
611impl DisableParams { pub const METHOD: &'static str = "Accessibility.disable"; }
612
613impl<'a> crate::CdpCommand<'a> for DisableParams {
614    const METHOD: &'static str = "Accessibility.disable";
615    type Response = crate::EmptyReturns;
616}
617
618#[derive(Debug, Clone, Serialize, Deserialize, Default)]
619pub struct EnableParams {}
620
621impl EnableParams { pub const METHOD: &'static str = "Accessibility.enable"; }
622
623impl<'a> crate::CdpCommand<'a> for EnableParams {
624    const METHOD: &'static str = "Accessibility.enable";
625    type Response = crate::EmptyReturns;
626}
627
628/// Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
629
630#[derive(Debug, Clone, Serialize, Deserialize, Default)]
631#[serde(rename_all = "camelCase")]
632pub struct GetPartialAXTreeParams<'a> {
633    /// Identifier of the node to get the partial accessibility tree for.
634    #[serde(skip_serializing_if = "Option::is_none")]
635    nodeId: Option<crate::dom::NodeId>,
636    /// Identifier of the backend node to get the partial accessibility tree for.
637    #[serde(skip_serializing_if = "Option::is_none")]
638    backendNodeId: Option<crate::dom::BackendNodeId>,
639    /// JavaScript object id of the node wrapper to get the partial accessibility tree for.
640    #[serde(skip_serializing_if = "Option::is_none")]
641    objectId: Option<crate::runtime::RemoteObjectId<'a>>,
642    /// Whether to fetch this node's ancestors, siblings and children. Defaults to true.
643    #[serde(skip_serializing_if = "Option::is_none")]
644    fetchRelatives: Option<bool>,
645}
646
647impl<'a> GetPartialAXTreeParams<'a> {
648    pub fn builder() -> GetPartialAXTreeParamsBuilder<'a> {
649        GetPartialAXTreeParamsBuilder {
650            nodeId: None,
651            backendNodeId: None,
652            objectId: None,
653            fetchRelatives: None,
654        }
655    }
656    pub fn nodeId(&self) -> Option<&crate::dom::NodeId> { self.nodeId.as_ref() }
657    pub fn backendNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.backendNodeId.as_ref() }
658    pub fn objectId(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.objectId.as_ref() }
659    pub fn fetchRelatives(&self) -> Option<bool> { self.fetchRelatives }
660}
661
662#[derive(Default)]
663pub struct GetPartialAXTreeParamsBuilder<'a> {
664    nodeId: Option<crate::dom::NodeId>,
665    backendNodeId: Option<crate::dom::BackendNodeId>,
666    objectId: Option<crate::runtime::RemoteObjectId<'a>>,
667    fetchRelatives: Option<bool>,
668}
669
670impl<'a> GetPartialAXTreeParamsBuilder<'a> {
671    /// Identifier of the node to get the partial accessibility tree for.
672    pub fn nodeId(mut self, nodeId: crate::dom::NodeId) -> Self { self.nodeId = Some(nodeId); self }
673    /// Identifier of the backend node to get the partial accessibility tree for.
674    pub fn backendNodeId(mut self, backendNodeId: crate::dom::BackendNodeId) -> Self { self.backendNodeId = Some(backendNodeId); self }
675    /// JavaScript object id of the node wrapper to get the partial accessibility tree for.
676    pub fn objectId(mut self, objectId: crate::runtime::RemoteObjectId<'a>) -> Self { self.objectId = Some(objectId); self }
677    /// Whether to fetch this node's ancestors, siblings and children. Defaults to true.
678    pub fn fetchRelatives(mut self, fetchRelatives: bool) -> Self { self.fetchRelatives = Some(fetchRelatives); self }
679    pub fn build(self) -> GetPartialAXTreeParams<'a> {
680        GetPartialAXTreeParams {
681            nodeId: self.nodeId,
682            backendNodeId: self.backendNodeId,
683            objectId: self.objectId,
684            fetchRelatives: self.fetchRelatives,
685        }
686    }
687}
688
689/// Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
690
691#[derive(Debug, Clone, Serialize, Deserialize, Default)]
692#[serde(rename_all = "camelCase")]
693pub struct GetPartialAXTreeReturns<'a> {
694    /// The 'Accessibility.AXNode' for this DOM node, if it exists, plus its ancestors, siblings and
695    /// children, if requested.
696    nodes: Vec<AXNode<'a>>,
697}
698
699impl<'a> GetPartialAXTreeReturns<'a> {
700    pub fn builder(nodes: Vec<AXNode<'a>>) -> GetPartialAXTreeReturnsBuilder<'a> {
701        GetPartialAXTreeReturnsBuilder {
702            nodes: nodes,
703        }
704    }
705    pub fn nodes(&self) -> &[AXNode<'a>] { &self.nodes }
706}
707
708
709pub struct GetPartialAXTreeReturnsBuilder<'a> {
710    nodes: Vec<AXNode<'a>>,
711}
712
713impl<'a> GetPartialAXTreeReturnsBuilder<'a> {
714    pub fn build(self) -> GetPartialAXTreeReturns<'a> {
715        GetPartialAXTreeReturns {
716            nodes: self.nodes,
717        }
718    }
719}
720
721impl<'a> GetPartialAXTreeParams<'a> { pub const METHOD: &'static str = "Accessibility.getPartialAXTree"; }
722
723impl<'a> crate::CdpCommand<'a> for GetPartialAXTreeParams<'a> {
724    const METHOD: &'static str = "Accessibility.getPartialAXTree";
725    type Response = GetPartialAXTreeReturns<'a>;
726}
727
728/// Fetches the entire accessibility tree for the root Document
729
730#[derive(Debug, Clone, Serialize, Deserialize, Default)]
731#[serde(rename_all = "camelCase")]
732pub struct GetFullAXTreeParams<'a> {
733    /// The maximum depth at which descendants of the root node should be retrieved.
734    /// If omitted, the full tree is returned.
735    #[serde(skip_serializing_if = "Option::is_none")]
736    depth: Option<i64>,
737    /// The frame for whose document the AX tree should be retrieved.
738    /// If omitted, the root frame is used.
739    #[serde(skip_serializing_if = "Option::is_none")]
740    frameId: Option<crate::page::FrameId<'a>>,
741}
742
743impl<'a> GetFullAXTreeParams<'a> {
744    pub fn builder() -> GetFullAXTreeParamsBuilder<'a> {
745        GetFullAXTreeParamsBuilder {
746            depth: None,
747            frameId: None,
748        }
749    }
750    pub fn depth(&self) -> Option<i64> { self.depth }
751    pub fn frameId(&self) -> Option<&crate::page::FrameId<'a>> { self.frameId.as_ref() }
752}
753
754#[derive(Default)]
755pub struct GetFullAXTreeParamsBuilder<'a> {
756    depth: Option<i64>,
757    frameId: Option<crate::page::FrameId<'a>>,
758}
759
760impl<'a> GetFullAXTreeParamsBuilder<'a> {
761    /// The maximum depth at which descendants of the root node should be retrieved.
762    /// If omitted, the full tree is returned.
763    pub fn depth(mut self, depth: i64) -> Self { self.depth = Some(depth); self }
764    /// The frame for whose document the AX tree should be retrieved.
765    /// If omitted, the root frame is used.
766    pub fn frameId(mut self, frameId: crate::page::FrameId<'a>) -> Self { self.frameId = Some(frameId); self }
767    pub fn build(self) -> GetFullAXTreeParams<'a> {
768        GetFullAXTreeParams {
769            depth: self.depth,
770            frameId: self.frameId,
771        }
772    }
773}
774
775/// Fetches the entire accessibility tree for the root Document
776
777#[derive(Debug, Clone, Serialize, Deserialize, Default)]
778#[serde(rename_all = "camelCase")]
779pub struct GetFullAXTreeReturns<'a> {
780    nodes: Vec<AXNode<'a>>,
781}
782
783impl<'a> GetFullAXTreeReturns<'a> {
784    pub fn builder(nodes: Vec<AXNode<'a>>) -> GetFullAXTreeReturnsBuilder<'a> {
785        GetFullAXTreeReturnsBuilder {
786            nodes: nodes,
787        }
788    }
789    pub fn nodes(&self) -> &[AXNode<'a>] { &self.nodes }
790}
791
792
793pub struct GetFullAXTreeReturnsBuilder<'a> {
794    nodes: Vec<AXNode<'a>>,
795}
796
797impl<'a> GetFullAXTreeReturnsBuilder<'a> {
798    pub fn build(self) -> GetFullAXTreeReturns<'a> {
799        GetFullAXTreeReturns {
800            nodes: self.nodes,
801        }
802    }
803}
804
805impl<'a> GetFullAXTreeParams<'a> { pub const METHOD: &'static str = "Accessibility.getFullAXTree"; }
806
807impl<'a> crate::CdpCommand<'a> for GetFullAXTreeParams<'a> {
808    const METHOD: &'static str = "Accessibility.getFullAXTree";
809    type Response = GetFullAXTreeReturns<'a>;
810}
811
812/// Fetches the root node.
813/// Requires 'enable()' to have been called previously.
814
815#[derive(Debug, Clone, Serialize, Deserialize, Default)]
816#[serde(rename_all = "camelCase")]
817pub struct GetRootAXNodeParams<'a> {
818    /// The frame in whose document the node resides.
819    /// If omitted, the root frame is used.
820    #[serde(skip_serializing_if = "Option::is_none")]
821    frameId: Option<crate::page::FrameId<'a>>,
822}
823
824impl<'a> GetRootAXNodeParams<'a> {
825    pub fn builder() -> GetRootAXNodeParamsBuilder<'a> {
826        GetRootAXNodeParamsBuilder {
827            frameId: None,
828        }
829    }
830    pub fn frameId(&self) -> Option<&crate::page::FrameId<'a>> { self.frameId.as_ref() }
831}
832
833#[derive(Default)]
834pub struct GetRootAXNodeParamsBuilder<'a> {
835    frameId: Option<crate::page::FrameId<'a>>,
836}
837
838impl<'a> GetRootAXNodeParamsBuilder<'a> {
839    /// The frame in whose document the node resides.
840    /// If omitted, the root frame is used.
841    pub fn frameId(mut self, frameId: crate::page::FrameId<'a>) -> Self { self.frameId = Some(frameId); self }
842    pub fn build(self) -> GetRootAXNodeParams<'a> {
843        GetRootAXNodeParams {
844            frameId: self.frameId,
845        }
846    }
847}
848
849/// Fetches the root node.
850/// Requires 'enable()' to have been called previously.
851
852#[derive(Debug, Clone, Serialize, Deserialize, Default)]
853#[serde(rename_all = "camelCase")]
854pub struct GetRootAXNodeReturns<'a> {
855    node: AXNode<'a>,
856}
857
858impl<'a> GetRootAXNodeReturns<'a> {
859    pub fn builder(node: AXNode<'a>) -> GetRootAXNodeReturnsBuilder<'a> {
860        GetRootAXNodeReturnsBuilder {
861            node: node,
862        }
863    }
864    pub fn node(&self) -> &AXNode<'a> { &self.node }
865}
866
867
868pub struct GetRootAXNodeReturnsBuilder<'a> {
869    node: AXNode<'a>,
870}
871
872impl<'a> GetRootAXNodeReturnsBuilder<'a> {
873    pub fn build(self) -> GetRootAXNodeReturns<'a> {
874        GetRootAXNodeReturns {
875            node: self.node,
876        }
877    }
878}
879
880impl<'a> GetRootAXNodeParams<'a> { pub const METHOD: &'static str = "Accessibility.getRootAXNode"; }
881
882impl<'a> crate::CdpCommand<'a> for GetRootAXNodeParams<'a> {
883    const METHOD: &'static str = "Accessibility.getRootAXNode";
884    type Response = GetRootAXNodeReturns<'a>;
885}
886
887/// Fetches a node and all ancestors up to and including the root.
888/// Requires 'enable()' to have been called previously.
889
890#[derive(Debug, Clone, Serialize, Deserialize, Default)]
891#[serde(rename_all = "camelCase")]
892pub struct GetAXNodeAndAncestorsParams<'a> {
893    /// Identifier of the node to get.
894    #[serde(skip_serializing_if = "Option::is_none")]
895    nodeId: Option<crate::dom::NodeId>,
896    /// Identifier of the backend node to get.
897    #[serde(skip_serializing_if = "Option::is_none")]
898    backendNodeId: Option<crate::dom::BackendNodeId>,
899    /// JavaScript object id of the node wrapper to get.
900    #[serde(skip_serializing_if = "Option::is_none")]
901    objectId: Option<crate::runtime::RemoteObjectId<'a>>,
902}
903
904impl<'a> GetAXNodeAndAncestorsParams<'a> {
905    pub fn builder() -> GetAXNodeAndAncestorsParamsBuilder<'a> {
906        GetAXNodeAndAncestorsParamsBuilder {
907            nodeId: None,
908            backendNodeId: None,
909            objectId: None,
910        }
911    }
912    pub fn nodeId(&self) -> Option<&crate::dom::NodeId> { self.nodeId.as_ref() }
913    pub fn backendNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.backendNodeId.as_ref() }
914    pub fn objectId(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.objectId.as_ref() }
915}
916
917#[derive(Default)]
918pub struct GetAXNodeAndAncestorsParamsBuilder<'a> {
919    nodeId: Option<crate::dom::NodeId>,
920    backendNodeId: Option<crate::dom::BackendNodeId>,
921    objectId: Option<crate::runtime::RemoteObjectId<'a>>,
922}
923
924impl<'a> GetAXNodeAndAncestorsParamsBuilder<'a> {
925    /// Identifier of the node to get.
926    pub fn nodeId(mut self, nodeId: crate::dom::NodeId) -> Self { self.nodeId = Some(nodeId); self }
927    /// Identifier of the backend node to get.
928    pub fn backendNodeId(mut self, backendNodeId: crate::dom::BackendNodeId) -> Self { self.backendNodeId = Some(backendNodeId); self }
929    /// JavaScript object id of the node wrapper to get.
930    pub fn objectId(mut self, objectId: crate::runtime::RemoteObjectId<'a>) -> Self { self.objectId = Some(objectId); self }
931    pub fn build(self) -> GetAXNodeAndAncestorsParams<'a> {
932        GetAXNodeAndAncestorsParams {
933            nodeId: self.nodeId,
934            backendNodeId: self.backendNodeId,
935            objectId: self.objectId,
936        }
937    }
938}
939
940/// Fetches a node and all ancestors up to and including the root.
941/// Requires 'enable()' to have been called previously.
942
943#[derive(Debug, Clone, Serialize, Deserialize, Default)]
944#[serde(rename_all = "camelCase")]
945pub struct GetAXNodeAndAncestorsReturns<'a> {
946    nodes: Vec<AXNode<'a>>,
947}
948
949impl<'a> GetAXNodeAndAncestorsReturns<'a> {
950    pub fn builder(nodes: Vec<AXNode<'a>>) -> GetAXNodeAndAncestorsReturnsBuilder<'a> {
951        GetAXNodeAndAncestorsReturnsBuilder {
952            nodes: nodes,
953        }
954    }
955    pub fn nodes(&self) -> &[AXNode<'a>] { &self.nodes }
956}
957
958
959pub struct GetAXNodeAndAncestorsReturnsBuilder<'a> {
960    nodes: Vec<AXNode<'a>>,
961}
962
963impl<'a> GetAXNodeAndAncestorsReturnsBuilder<'a> {
964    pub fn build(self) -> GetAXNodeAndAncestorsReturns<'a> {
965        GetAXNodeAndAncestorsReturns {
966            nodes: self.nodes,
967        }
968    }
969}
970
971impl<'a> GetAXNodeAndAncestorsParams<'a> { pub const METHOD: &'static str = "Accessibility.getAXNodeAndAncestors"; }
972
973impl<'a> crate::CdpCommand<'a> for GetAXNodeAndAncestorsParams<'a> {
974    const METHOD: &'static str = "Accessibility.getAXNodeAndAncestors";
975    type Response = GetAXNodeAndAncestorsReturns<'a>;
976}
977
978/// Fetches a particular accessibility node by AXNodeId.
979/// Requires 'enable()' to have been called previously.
980
981#[derive(Debug, Clone, Serialize, Deserialize, Default)]
982#[serde(rename_all = "camelCase")]
983pub struct GetChildAXNodesParams<'a> {
984    id: AXNodeId<'a>,
985    /// The frame in whose document the node resides.
986    /// If omitted, the root frame is used.
987    #[serde(skip_serializing_if = "Option::is_none")]
988    frameId: Option<crate::page::FrameId<'a>>,
989}
990
991impl<'a> GetChildAXNodesParams<'a> {
992    pub fn builder(id: AXNodeId<'a>) -> GetChildAXNodesParamsBuilder<'a> {
993        GetChildAXNodesParamsBuilder {
994            id: id,
995            frameId: None,
996        }
997    }
998    pub fn id(&self) -> &AXNodeId<'a> { &self.id }
999    pub fn frameId(&self) -> Option<&crate::page::FrameId<'a>> { self.frameId.as_ref() }
1000}
1001
1002
1003pub struct GetChildAXNodesParamsBuilder<'a> {
1004    id: AXNodeId<'a>,
1005    frameId: Option<crate::page::FrameId<'a>>,
1006}
1007
1008impl<'a> GetChildAXNodesParamsBuilder<'a> {
1009    /// The frame in whose document the node resides.
1010    /// If omitted, the root frame is used.
1011    pub fn frameId(mut self, frameId: crate::page::FrameId<'a>) -> Self { self.frameId = Some(frameId); self }
1012    pub fn build(self) -> GetChildAXNodesParams<'a> {
1013        GetChildAXNodesParams {
1014            id: self.id,
1015            frameId: self.frameId,
1016        }
1017    }
1018}
1019
1020/// Fetches a particular accessibility node by AXNodeId.
1021/// Requires 'enable()' to have been called previously.
1022
1023#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1024#[serde(rename_all = "camelCase")]
1025pub struct GetChildAXNodesReturns<'a> {
1026    nodes: Vec<AXNode<'a>>,
1027}
1028
1029impl<'a> GetChildAXNodesReturns<'a> {
1030    pub fn builder(nodes: Vec<AXNode<'a>>) -> GetChildAXNodesReturnsBuilder<'a> {
1031        GetChildAXNodesReturnsBuilder {
1032            nodes: nodes,
1033        }
1034    }
1035    pub fn nodes(&self) -> &[AXNode<'a>] { &self.nodes }
1036}
1037
1038
1039pub struct GetChildAXNodesReturnsBuilder<'a> {
1040    nodes: Vec<AXNode<'a>>,
1041}
1042
1043impl<'a> GetChildAXNodesReturnsBuilder<'a> {
1044    pub fn build(self) -> GetChildAXNodesReturns<'a> {
1045        GetChildAXNodesReturns {
1046            nodes: self.nodes,
1047        }
1048    }
1049}
1050
1051impl<'a> GetChildAXNodesParams<'a> { pub const METHOD: &'static str = "Accessibility.getChildAXNodes"; }
1052
1053impl<'a> crate::CdpCommand<'a> for GetChildAXNodesParams<'a> {
1054    const METHOD: &'static str = "Accessibility.getChildAXNodes";
1055    type Response = GetChildAXNodesReturns<'a>;
1056}
1057
1058/// Query a DOM node's accessibility subtree for accessible name and role.
1059/// This command computes the name and role for all nodes in the subtree, including those that are
1060/// ignored for accessibility, and returns those that match the specified name and role. If no DOM
1061/// node is specified, or the DOM node does not exist, the command returns an error. If neither
1062/// 'accessibleName' or 'role' is specified, it returns all the accessibility nodes in the subtree.
1063
1064#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1065#[serde(rename_all = "camelCase")]
1066pub struct QueryAXTreeParams<'a> {
1067    /// Identifier of the node for the root to query.
1068    #[serde(skip_serializing_if = "Option::is_none")]
1069    nodeId: Option<crate::dom::NodeId>,
1070    /// Identifier of the backend node for the root to query.
1071    #[serde(skip_serializing_if = "Option::is_none")]
1072    backendNodeId: Option<crate::dom::BackendNodeId>,
1073    /// JavaScript object id of the node wrapper for the root to query.
1074    #[serde(skip_serializing_if = "Option::is_none")]
1075    objectId: Option<crate::runtime::RemoteObjectId<'a>>,
1076    /// Find nodes with this computed name.
1077    #[serde(skip_serializing_if = "Option::is_none")]
1078    accessibleName: Option<Cow<'a, str>>,
1079    /// Find nodes with this computed role.
1080    #[serde(skip_serializing_if = "Option::is_none")]
1081    role: Option<Cow<'a, str>>,
1082}
1083
1084impl<'a> QueryAXTreeParams<'a> {
1085    pub fn builder() -> QueryAXTreeParamsBuilder<'a> {
1086        QueryAXTreeParamsBuilder {
1087            nodeId: None,
1088            backendNodeId: None,
1089            objectId: None,
1090            accessibleName: None,
1091            role: None,
1092        }
1093    }
1094    pub fn nodeId(&self) -> Option<&crate::dom::NodeId> { self.nodeId.as_ref() }
1095    pub fn backendNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.backendNodeId.as_ref() }
1096    pub fn objectId(&self) -> Option<&crate::runtime::RemoteObjectId<'a>> { self.objectId.as_ref() }
1097    pub fn accessibleName(&self) -> Option<&str> { self.accessibleName.as_deref() }
1098    pub fn role(&self) -> Option<&str> { self.role.as_deref() }
1099}
1100
1101#[derive(Default)]
1102pub struct QueryAXTreeParamsBuilder<'a> {
1103    nodeId: Option<crate::dom::NodeId>,
1104    backendNodeId: Option<crate::dom::BackendNodeId>,
1105    objectId: Option<crate::runtime::RemoteObjectId<'a>>,
1106    accessibleName: Option<Cow<'a, str>>,
1107    role: Option<Cow<'a, str>>,
1108}
1109
1110impl<'a> QueryAXTreeParamsBuilder<'a> {
1111    /// Identifier of the node for the root to query.
1112    pub fn nodeId(mut self, nodeId: crate::dom::NodeId) -> Self { self.nodeId = Some(nodeId); self }
1113    /// Identifier of the backend node for the root to query.
1114    pub fn backendNodeId(mut self, backendNodeId: crate::dom::BackendNodeId) -> Self { self.backendNodeId = Some(backendNodeId); self }
1115    /// JavaScript object id of the node wrapper for the root to query.
1116    pub fn objectId(mut self, objectId: crate::runtime::RemoteObjectId<'a>) -> Self { self.objectId = Some(objectId); self }
1117    /// Find nodes with this computed name.
1118    pub fn accessibleName(mut self, accessibleName: impl Into<Cow<'a, str>>) -> Self { self.accessibleName = Some(accessibleName.into()); self }
1119    /// Find nodes with this computed role.
1120    pub fn role(mut self, role: impl Into<Cow<'a, str>>) -> Self { self.role = Some(role.into()); self }
1121    pub fn build(self) -> QueryAXTreeParams<'a> {
1122        QueryAXTreeParams {
1123            nodeId: self.nodeId,
1124            backendNodeId: self.backendNodeId,
1125            objectId: self.objectId,
1126            accessibleName: self.accessibleName,
1127            role: self.role,
1128        }
1129    }
1130}
1131
1132/// Query a DOM node's accessibility subtree for accessible name and role.
1133/// This command computes the name and role for all nodes in the subtree, including those that are
1134/// ignored for accessibility, and returns those that match the specified name and role. If no DOM
1135/// node is specified, or the DOM node does not exist, the command returns an error. If neither
1136/// 'accessibleName' or 'role' is specified, it returns all the accessibility nodes in the subtree.
1137
1138#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1139#[serde(rename_all = "camelCase")]
1140pub struct QueryAXTreeReturns<'a> {
1141    /// A list of 'Accessibility.AXNode' matching the specified attributes,
1142    /// including nodes that are ignored for accessibility.
1143    nodes: Vec<AXNode<'a>>,
1144}
1145
1146impl<'a> QueryAXTreeReturns<'a> {
1147    pub fn builder(nodes: Vec<AXNode<'a>>) -> QueryAXTreeReturnsBuilder<'a> {
1148        QueryAXTreeReturnsBuilder {
1149            nodes: nodes,
1150        }
1151    }
1152    pub fn nodes(&self) -> &[AXNode<'a>] { &self.nodes }
1153}
1154
1155
1156pub struct QueryAXTreeReturnsBuilder<'a> {
1157    nodes: Vec<AXNode<'a>>,
1158}
1159
1160impl<'a> QueryAXTreeReturnsBuilder<'a> {
1161    pub fn build(self) -> QueryAXTreeReturns<'a> {
1162        QueryAXTreeReturns {
1163            nodes: self.nodes,
1164        }
1165    }
1166}
1167
1168impl<'a> QueryAXTreeParams<'a> { pub const METHOD: &'static str = "Accessibility.queryAXTree"; }
1169
1170impl<'a> crate::CdpCommand<'a> for QueryAXTreeParams<'a> {
1171    const METHOD: &'static str = "Accessibility.queryAXTree";
1172    type Response = QueryAXTreeReturns<'a>;
1173}