1- '''
2- DO NOT EDIT THIS FILE
3-
4- This file is generated from the CDP specification. If you need to make changes,
5- edit the generator and regenerate all of the modules.
6-
7- Domain: Accessibility
8- Experimental: True
9- '''
10-
1+ # DO NOT EDIT THIS FILE!
2+ #
3+ # This file is generated from the CDP specification. If you need to make
4+ # changes, edit the generator and regenerate all of the modules.
5+ #
6+ # CDP domain: Accessibility (experimental)
7+
8+ from __future__ import annotations
119from cdp .util import event_class , T_JSON_DICT
1210from dataclasses import dataclass
1311import enum
@@ -25,7 +23,7 @@ def to_json(self) -> str:
2523 return self
2624
2725 @classmethod
28- def from_json (cls , json : str ) -> ' AXNodeId' :
26+ def from_json (cls , json : str ) -> AXNodeId :
2927 return cls (json )
3028
3129 def __repr__ (self ):
@@ -58,7 +56,7 @@ def to_json(self) -> str:
5856 return self .value
5957
6058 @classmethod
61- def from_json (cls , json : str ) -> ' AXValueType' :
59+ def from_json (cls , json : str ) -> AXValueType :
6260 return cls (json )
6361
6462
@@ -77,7 +75,7 @@ def to_json(self) -> str:
7775 return self .value
7876
7977 @classmethod
80- def from_json (cls , json : str ) -> ' AXValueSourceType' :
78+ def from_json (cls , json : str ) -> AXValueSourceType :
8179 return cls (json )
8280
8381
@@ -98,7 +96,7 @@ def to_json(self) -> str:
9896 return self .value
9997
10098 @classmethod
101- def from_json (cls , json : str ) -> ' AXValueNativeSourceType' :
99+ def from_json (cls , json : str ) -> AXValueNativeSourceType :
102100 return cls (json )
103101
104102
@@ -108,25 +106,25 @@ class AXValueSource:
108106 A single source for a computed AX property.
109107 '''
110108 #: What type of source this is.
111- type : ' AXValueSourceType'
109+ type_ : AXValueSourceType
112110
113111 #: The value of this property source.
114- value : typing .Optional [' AXValue' ] = None
112+ value : typing .Optional [AXValue ] = None
115113
116114 #: The name of the relevant attribute, if any.
117115 attribute : typing .Optional [str ] = None
118116
119117 #: The value of the relevant attribute, if any.
120- attribute_value : typing .Optional [' AXValue' ] = None
118+ attribute_value : typing .Optional [AXValue ] = None
121119
122120 #: Whether this source is superseded by a higher priority source.
123121 superseded : typing .Optional [bool ] = None
124122
125123 #: The native markup source for this value, e.g. a <label> element.
126- native_source : typing .Optional [' AXValueNativeSourceType' ] = None
124+ native_source : typing .Optional [AXValueNativeSourceType ] = None
127125
128126 #: The value, such as a node or node list, of the native source.
129- native_source_value : typing .Optional [' AXValue' ] = None
127+ native_source_value : typing .Optional [AXValue ] = None
130128
131129 #: Whether the value for this property is invalid.
132130 invalid : typing .Optional [bool ] = None
@@ -136,7 +134,7 @@ class AXValueSource:
136134
137135 def to_json (self ) -> T_JSON_DICT :
138136 json : T_JSON_DICT = dict ()
139- json ['type' ] = self .type .to_json ()
137+ json ['type' ] = self .type_ .to_json ()
140138 if self .value is not None :
141139 json ['value' ] = self .value .to_json ()
142140 if self .attribute is not None :
@@ -156,9 +154,9 @@ def to_json(self) -> T_JSON_DICT:
156154 return json
157155
158156 @classmethod
159- def from_json (cls , json : T_JSON_DICT ) -> ' AXValueSource' :
157+ def from_json (cls , json : T_JSON_DICT ) -> AXValueSource :
160158 return cls (
161- type = AXValueSourceType .from_json (json ['type' ]),
159+ type_ = AXValueSourceType .from_json (json ['type' ]),
162160 value = AXValue .from_json (json ['value' ]) if 'value' in json else None ,
163161 attribute = str (json ['attribute' ]) if 'attribute' in json else None ,
164162 attribute_value = AXValue .from_json (json ['attributeValue' ]) if 'attributeValue' in json else None ,
@@ -173,7 +171,7 @@ def from_json(cls, json: T_JSON_DICT) -> 'AXValueSource':
173171@dataclass
174172class AXRelatedNode :
175173 #: The BackendNodeId of the related DOM node.
176- backend_dom_node_id : ' dom.BackendNodeId'
174+ backend_dom_node_id : dom .BackendNodeId
177175
178176 #: The IDRef value provided, if any.
179177 idref : typing .Optional [str ] = None
@@ -191,7 +189,7 @@ def to_json(self) -> T_JSON_DICT:
191189 return json
192190
193191 @classmethod
194- def from_json (cls , json : T_JSON_DICT ) -> ' AXRelatedNode' :
192+ def from_json (cls , json : T_JSON_DICT ) -> AXRelatedNode :
195193 return cls (
196194 backend_dom_node_id = dom .BackendNodeId .from_json (json ['backendDOMNodeId' ]),
197195 idref = str (json ['idref' ]) if 'idref' in json else None ,
@@ -202,10 +200,10 @@ def from_json(cls, json: T_JSON_DICT) -> 'AXRelatedNode':
202200@dataclass
203201class AXProperty :
204202 #: The name of this property.
205- name : ' AXPropertyName'
203+ name : AXPropertyName
206204
207205 #: The value of this property.
208- value : ' AXValue'
206+ value : AXValue
209207
210208 def to_json (self ) -> T_JSON_DICT :
211209 json : T_JSON_DICT = dict ()
@@ -214,7 +212,7 @@ def to_json(self) -> T_JSON_DICT:
214212 return json
215213
216214 @classmethod
217- def from_json (cls , json : T_JSON_DICT ) -> ' AXProperty' :
215+ def from_json (cls , json : T_JSON_DICT ) -> AXProperty :
218216 return cls (
219217 name = AXPropertyName .from_json (json ['name' ]),
220218 value = AXValue .from_json (json ['value' ]),
@@ -227,20 +225,20 @@ class AXValue:
227225 A single computed AX property.
228226 '''
229227 #: The type of this value.
230- type : ' AXValueType'
228+ type_ : AXValueType
231229
232230 #: The computed value of this property.
233231 value : typing .Optional [typing .Any ] = None
234232
235233 #: One or more related nodes, if applicable.
236- related_nodes : typing .Optional [typing .List [' AXRelatedNode' ]] = None
234+ related_nodes : typing .Optional [typing .List [AXRelatedNode ]] = None
237235
238236 #: The sources which contributed to the computation of this property.
239- sources : typing .Optional [typing .List [' AXValueSource' ]] = None
237+ sources : typing .Optional [typing .List [AXValueSource ]] = None
240238
241239 def to_json (self ) -> T_JSON_DICT :
242240 json : T_JSON_DICT = dict ()
243- json ['type' ] = self .type .to_json ()
241+ json ['type' ] = self .type_ .to_json ()
244242 if self .value is not None :
245243 json ['value' ] = self .value
246244 if self .related_nodes is not None :
@@ -250,9 +248,9 @@ def to_json(self) -> T_JSON_DICT:
250248 return json
251249
252250 @classmethod
253- def from_json (cls , json : T_JSON_DICT ) -> ' AXValue' :
251+ def from_json (cls , json : T_JSON_DICT ) -> AXValue :
254252 return cls (
255- type = AXValueType .from_json (json ['type' ]),
253+ type_ = AXValueType .from_json (json ['type' ]),
256254 value = json ['value' ] if 'value' in json else None ,
257255 related_nodes = [AXRelatedNode .from_json (i ) for i in json ['relatedNodes' ]] if 'relatedNodes' in json else None ,
258256 sources = [AXValueSource .from_json (i ) for i in json ['sources' ]] if 'sources' in json else None ,
@@ -312,7 +310,7 @@ def to_json(self) -> str:
312310 return self .value
313311
314312 @classmethod
315- def from_json (cls , json : str ) -> ' AXPropertyName' :
313+ def from_json (cls , json : str ) -> AXPropertyName :
316314 return cls (json )
317315
318316
@@ -322,34 +320,34 @@ class AXNode:
322320 A node in the accessibility tree.
323321 '''
324322 #: Unique identifier for this node.
325- node_id : ' AXNodeId'
323+ node_id : AXNodeId
326324
327325 #: Whether this node is ignored for accessibility
328326 ignored : bool
329327
330328 #: Collection of reasons why this node is hidden.
331- ignored_reasons : typing .Optional [typing .List [' AXProperty' ]] = None
329+ ignored_reasons : typing .Optional [typing .List [AXProperty ]] = None
332330
333- #: This `Node`'s role, whether explicit or implicit.
334- role : typing .Optional [' AXValue' ] = None
331+ #: This `` Node` `'s role, whether explicit or implicit.
332+ role : typing .Optional [AXValue ] = None
335333
336- #: The accessible name for this `Node`.
337- name : typing .Optional [' AXValue' ] = None
334+ #: The accessible name for this `` Node` `.
335+ name : typing .Optional [AXValue ] = None
338336
339- #: The accessible description for this `Node`.
340- description : typing .Optional [' AXValue' ] = None
337+ #: The accessible description for this `` Node` `.
338+ description : typing .Optional [AXValue ] = None
341339
342- #: The value for this `Node`.
343- value : typing .Optional [' AXValue' ] = None
340+ #: The value for this `` Node` `.
341+ value : typing .Optional [AXValue ] = None
344342
345343 #: All other properties
346- properties : typing .Optional [typing .List [' AXProperty' ]] = None
344+ properties : typing .Optional [typing .List [AXProperty ]] = None
347345
348346 #: IDs for each of this node's child nodes.
349- child_ids : typing .Optional [typing .List [' AXNodeId' ]] = None
347+ child_ids : typing .Optional [typing .List [AXNodeId ]] = None
350348
351349 #: The backend ID for the associated DOM node, if any.
352- backend_dom_node_id : typing .Optional [' dom.BackendNodeId' ] = None
350+ backend_dom_node_id : typing .Optional [dom .BackendNodeId ] = None
353351
354352 def to_json (self ) -> T_JSON_DICT :
355353 json : T_JSON_DICT = dict ()
@@ -374,7 +372,7 @@ def to_json(self) -> T_JSON_DICT:
374372 return json
375373
376374 @classmethod
377- def from_json (cls , json : T_JSON_DICT ) -> ' AXNode' :
375+ def from_json (cls , json : T_JSON_DICT ) -> AXNode :
378376 return cls (
379377 node_id = AXNodeId .from_json (json ['nodeId' ]),
380378 ignored = bool (json ['ignored' ]),
@@ -401,7 +399,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
401399
402400def enable () -> typing .Generator [T_JSON_DICT ,T_JSON_DICT ,None ]:
403401 '''
404- Enables the accessibility domain which causes `AXNodeId`s to remain consistent between method calls.
402+ Enables the accessibility domain which causes `` AXNodeId``' s to remain consistent between method calls.
405403 This turns on accessibility for the page, which can impact performance until accessibility is disabled.
406404 '''
407405 cmd_dict : T_JSON_DICT = {
@@ -411,22 +409,21 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
411409
412410
413411def get_partial_ax_tree (
414- node_id : typing .Optional [' dom.NodeId' ] = None ,
415- backend_node_id : typing .Optional [' dom.BackendNodeId' ] = None ,
416- object_id : typing .Optional [' runtime.RemoteObjectId' ] = None ,
412+ node_id : typing .Optional [dom .NodeId ] = None ,
413+ backend_node_id : typing .Optional [dom .BackendNodeId ] = None ,
414+ object_id : typing .Optional [runtime .RemoteObjectId ] = None ,
417415 fetch_relatives : typing .Optional [bool ] = None
418- ) -> typing .Generator [T_JSON_DICT ,T_JSON_DICT ,typing .List [' AXNode' ]]:
416+ ) -> typing .Generator [T_JSON_DICT ,T_JSON_DICT ,typing .List [AXNode ]]:
419417 '''
420- **EXPERIMENTAL**
421-
422418 Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
423419
420+ **EXPERIMENTAL**
421+
424422 :param node_id: *(Optional)* Identifier of the node to get the partial accessibility tree for.
425423 :param backend_node_id: *(Optional)* Identifier of the backend node to get the partial accessibility tree for.
426424 :param object_id: *(Optional)* JavaScript object id of the node wrapper to get the partial accessibility tree for.
427425 :param fetch_relatives: *(Optional)* Whether to fetch this nodes ancestors, siblings and children. Defaults to true.
428- :returns: The ``Accessibility.AXNode`` for this DOM node, if it exists, plus its ancestors, siblings and
429- children, if requested.
426+ :returns: The ``Accessibility.AXNode`` for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
430427 '''
431428 params : T_JSON_DICT = dict ()
432429 if node_id is not None :
@@ -445,12 +442,12 @@ def get_partial_ax_tree(
445442 return [AXNode .from_json (i ) for i in json ['nodes' ]]
446443
447444
448- def get_full_ax_tree () -> typing .Generator [T_JSON_DICT ,T_JSON_DICT ,typing .List [' AXNode' ]]:
445+ def get_full_ax_tree () -> typing .Generator [T_JSON_DICT ,T_JSON_DICT ,typing .List [AXNode ]]:
449446 '''
450- **EXPERIMENTAL**
451-
452447 Fetches the entire accessibility tree
453448
449+ **EXPERIMENTAL**
450+
454451 :returns:
455452 '''
456453 cmd_dict : T_JSON_DICT = {
0 commit comments