mithwire 0.50.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. mithwire/__init__.py +32 -0
  2. mithwire/cdp/README.md +4 -0
  3. mithwire/cdp/__init__.py +6 -0
  4. mithwire/cdp/accessibility.py +668 -0
  5. mithwire/cdp/animation.py +494 -0
  6. mithwire/cdp/audits.py +1995 -0
  7. mithwire/cdp/autofill.py +292 -0
  8. mithwire/cdp/background_service.py +215 -0
  9. mithwire/cdp/bluetooth_emulation.py +626 -0
  10. mithwire/cdp/browser.py +821 -0
  11. mithwire/cdp/cache_storage.py +311 -0
  12. mithwire/cdp/cast.py +172 -0
  13. mithwire/cdp/console.py +107 -0
  14. mithwire/cdp/crash_report_context.py +55 -0
  15. mithwire/cdp/css.py +2750 -0
  16. mithwire/cdp/database.py +179 -0
  17. mithwire/cdp/debugger.py +1405 -0
  18. mithwire/cdp/device_access.py +141 -0
  19. mithwire/cdp/device_orientation.py +45 -0
  20. mithwire/cdp/dom.py +2257 -0
  21. mithwire/cdp/dom_debugger.py +321 -0
  22. mithwire/cdp/dom_snapshot.py +876 -0
  23. mithwire/cdp/dom_storage.py +222 -0
  24. mithwire/cdp/emulation.py +1779 -0
  25. mithwire/cdp/event_breakpoints.py +56 -0
  26. mithwire/cdp/extensions.py +238 -0
  27. mithwire/cdp/fed_cm.py +283 -0
  28. mithwire/cdp/fetch.py +507 -0
  29. mithwire/cdp/file_system.py +115 -0
  30. mithwire/cdp/headless_experimental.py +115 -0
  31. mithwire/cdp/heap_profiler.py +401 -0
  32. mithwire/cdp/indexed_db.py +528 -0
  33. mithwire/cdp/input_.py +701 -0
  34. mithwire/cdp/inspector.py +95 -0
  35. mithwire/cdp/io.py +101 -0
  36. mithwire/cdp/layer_tree.py +464 -0
  37. mithwire/cdp/log.py +190 -0
  38. mithwire/cdp/media.py +313 -0
  39. mithwire/cdp/memory.py +305 -0
  40. mithwire/cdp/network.py +5342 -0
  41. mithwire/cdp/overlay.py +1468 -0
  42. mithwire/cdp/page.py +3972 -0
  43. mithwire/cdp/performance.py +124 -0
  44. mithwire/cdp/performance_timeline.py +200 -0
  45. mithwire/cdp/preload.py +575 -0
  46. mithwire/cdp/profiler.py +420 -0
  47. mithwire/cdp/pwa.py +278 -0
  48. mithwire/cdp/py.typed +0 -0
  49. mithwire/cdp/runtime.py +1589 -0
  50. mithwire/cdp/schema.py +50 -0
  51. mithwire/cdp/security.py +518 -0
  52. mithwire/cdp/service_worker.py +401 -0
  53. mithwire/cdp/smart_card_emulation.py +891 -0
  54. mithwire/cdp/storage.py +1573 -0
  55. mithwire/cdp/system_info.py +327 -0
  56. mithwire/cdp/target.py +829 -0
  57. mithwire/cdp/tethering.py +65 -0
  58. mithwire/cdp/tracing.py +377 -0
  59. mithwire/cdp/util.py +18 -0
  60. mithwire/cdp/web_audio.py +606 -0
  61. mithwire/cdp/web_authn.py +598 -0
  62. mithwire/cdp/web_mcp.py +293 -0
  63. mithwire/core/_contradict.py +142 -0
  64. mithwire/core/browser.py +923 -0
  65. mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
  66. mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
  67. mithwire/core/config.py +323 -0
  68. mithwire/core/connection.py +564 -0
  69. mithwire/core/element.py +1205 -0
  70. mithwire/core/tab.py +2202 -0
  71. mithwire/core/util.py +5063 -0
  72. mithwire-0.50.3.dist-info/METADATA +1049 -0
  73. mithwire-0.50.3.dist-info/RECORD +76 -0
  74. mithwire-0.50.3.dist-info/WHEEL +5 -0
  75. mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
  76. mithwire-0.50.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,668 @@
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
9
+ import enum
10
+ import typing
11
+ from dataclasses import dataclass
12
+ from .util import event_class, T_JSON_DICT
13
+
14
+ from . import dom
15
+ from . import page
16
+ from . import runtime
17
+
18
+
19
+ class AXNodeId(str):
20
+ '''
21
+ Unique accessibility node identifier.
22
+ '''
23
+ def to_json(self) -> str:
24
+ return self
25
+
26
+ @classmethod
27
+ def from_json(cls, json: str) -> AXNodeId:
28
+ return cls(json)
29
+
30
+ def __repr__(self):
31
+ return 'AXNodeId({})'.format(super().__repr__())
32
+
33
+
34
+ class AXValueType(enum.Enum):
35
+ '''
36
+ Enum of possible property types.
37
+ '''
38
+ BOOLEAN = "boolean"
39
+ TRISTATE = "tristate"
40
+ BOOLEAN_OR_UNDEFINED = "booleanOrUndefined"
41
+ IDREF = "idref"
42
+ IDREF_LIST = "idrefList"
43
+ INTEGER = "integer"
44
+ NODE = "node"
45
+ NODE_LIST = "nodeList"
46
+ NUMBER = "number"
47
+ STRING = "string"
48
+ COMPUTED_STRING = "computedString"
49
+ TOKEN = "token"
50
+ TOKEN_LIST = "tokenList"
51
+ DOM_RELATION = "domRelation"
52
+ ROLE = "role"
53
+ INTERNAL_ROLE = "internalRole"
54
+ VALUE_UNDEFINED = "valueUndefined"
55
+
56
+ def to_json(self) -> str:
57
+ return self.value
58
+
59
+ @classmethod
60
+ def from_json(cls, json: str) -> AXValueType:
61
+ return cls(json)
62
+
63
+
64
+ class AXValueSourceType(enum.Enum):
65
+ '''
66
+ Enum of possible property sources.
67
+ '''
68
+ ATTRIBUTE = "attribute"
69
+ IMPLICIT = "implicit"
70
+ STYLE = "style"
71
+ CONTENTS = "contents"
72
+ PLACEHOLDER = "placeholder"
73
+ RELATED_ELEMENT = "relatedElement"
74
+
75
+ def to_json(self) -> str:
76
+ return self.value
77
+
78
+ @classmethod
79
+ def from_json(cls, json: str) -> AXValueSourceType:
80
+ return cls(json)
81
+
82
+
83
+ class AXValueNativeSourceType(enum.Enum):
84
+ '''
85
+ Enum of possible native property sources (as a subtype of a particular AXValueSourceType).
86
+ '''
87
+ DESCRIPTION = "description"
88
+ FIGCAPTION = "figcaption"
89
+ LABEL = "label"
90
+ LABELFOR = "labelfor"
91
+ LABELWRAPPED = "labelwrapped"
92
+ LEGEND = "legend"
93
+ RUBYANNOTATION = "rubyannotation"
94
+ TABLECAPTION = "tablecaption"
95
+ TITLE = "title"
96
+ OTHER = "other"
97
+
98
+ def to_json(self) -> str:
99
+ return self.value
100
+
101
+ @classmethod
102
+ def from_json(cls, json: str) -> AXValueNativeSourceType:
103
+ return cls(json)
104
+
105
+
106
+ @dataclass
107
+ class AXValueSource:
108
+ '''
109
+ A single source for a computed AX property.
110
+ '''
111
+ #: What type of source this is.
112
+ type_: AXValueSourceType
113
+
114
+ #: The value of this property source.
115
+ value: typing.Optional[AXValue] = None
116
+
117
+ #: The name of the relevant attribute, if any.
118
+ attribute: typing.Optional[str] = None
119
+
120
+ #: The value of the relevant attribute, if any.
121
+ attribute_value: typing.Optional[AXValue] = None
122
+
123
+ #: Whether this source is superseded by a higher priority source.
124
+ superseded: typing.Optional[bool] = None
125
+
126
+ #: The native markup source for this value, e.g. a ``<label>`` element.
127
+ native_source: typing.Optional[AXValueNativeSourceType] = None
128
+
129
+ #: The value, such as a node or node list, of the native source.
130
+ native_source_value: typing.Optional[AXValue] = None
131
+
132
+ #: Whether the value for this property is invalid.
133
+ invalid: typing.Optional[bool] = None
134
+
135
+ #: Reason for the value being invalid, if it is.
136
+ invalid_reason: typing.Optional[str] = None
137
+
138
+ def to_json(self) -> T_JSON_DICT:
139
+ json: T_JSON_DICT = dict()
140
+ json['type'] = self.type_.to_json()
141
+ if self.value is not None:
142
+ json['value'] = self.value.to_json()
143
+ if self.attribute is not None:
144
+ json['attribute'] = self.attribute
145
+ if self.attribute_value is not None:
146
+ json['attributeValue'] = self.attribute_value.to_json()
147
+ if self.superseded is not None:
148
+ json['superseded'] = self.superseded
149
+ if self.native_source is not None:
150
+ json['nativeSource'] = self.native_source.to_json()
151
+ if self.native_source_value is not None:
152
+ json['nativeSourceValue'] = self.native_source_value.to_json()
153
+ if self.invalid is not None:
154
+ json['invalid'] = self.invalid
155
+ if self.invalid_reason is not None:
156
+ json['invalidReason'] = self.invalid_reason
157
+ return json
158
+
159
+ @classmethod
160
+ def from_json(cls, json: T_JSON_DICT) -> AXValueSource:
161
+ return cls(
162
+ type_=AXValueSourceType.from_json(json['type']),
163
+ value=AXValue.from_json(json['value']) if json.get('value', None) is not None else None,
164
+ attribute=str(json['attribute']) if json.get('attribute', None) is not None else None,
165
+ attribute_value=AXValue.from_json(json['attributeValue']) if json.get('attributeValue', None) is not None else None,
166
+ superseded=bool(json['superseded']) if json.get('superseded', None) is not None else None,
167
+ native_source=AXValueNativeSourceType.from_json(json['nativeSource']) if json.get('nativeSource', None) is not None else None,
168
+ native_source_value=AXValue.from_json(json['nativeSourceValue']) if json.get('nativeSourceValue', None) is not None else None,
169
+ invalid=bool(json['invalid']) if json.get('invalid', None) is not None else None,
170
+ invalid_reason=str(json['invalidReason']) if json.get('invalidReason', None) is not None else None,
171
+ )
172
+
173
+
174
+ @dataclass
175
+ class AXRelatedNode:
176
+ #: The BackendNodeId of the related DOM node.
177
+ backend_dom_node_id: dom.BackendNodeId
178
+
179
+ #: The IDRef value provided, if any.
180
+ idref: typing.Optional[str] = None
181
+
182
+ #: The text alternative of this node in the current context.
183
+ text: typing.Optional[str] = None
184
+
185
+ def to_json(self) -> T_JSON_DICT:
186
+ json: T_JSON_DICT = dict()
187
+ json['backendDOMNodeId'] = self.backend_dom_node_id.to_json()
188
+ if self.idref is not None:
189
+ json['idref'] = self.idref
190
+ if self.text is not None:
191
+ json['text'] = self.text
192
+ return json
193
+
194
+ @classmethod
195
+ def from_json(cls, json: T_JSON_DICT) -> AXRelatedNode:
196
+ return cls(
197
+ backend_dom_node_id=dom.BackendNodeId.from_json(json['backendDOMNodeId']),
198
+ idref=str(json['idref']) if json.get('idref', None) is not None else None,
199
+ text=str(json['text']) if json.get('text', None) is not None else None,
200
+ )
201
+
202
+
203
+ @dataclass
204
+ class AXProperty:
205
+ #: The name of this property.
206
+ name: AXPropertyName
207
+
208
+ #: The value of this property.
209
+ value: AXValue
210
+
211
+ def to_json(self) -> T_JSON_DICT:
212
+ json: T_JSON_DICT = dict()
213
+ json['name'] = self.name.to_json()
214
+ json['value'] = self.value.to_json()
215
+ return json
216
+
217
+ @classmethod
218
+ def from_json(cls, json: T_JSON_DICT) -> AXProperty:
219
+ return cls(
220
+ name=AXPropertyName.from_json(json['name']),
221
+ value=AXValue.from_json(json['value']),
222
+ )
223
+
224
+
225
+ @dataclass
226
+ class AXValue:
227
+ '''
228
+ A single computed AX property.
229
+ '''
230
+ #: The type of this value.
231
+ type_: AXValueType
232
+
233
+ #: The computed value of this property.
234
+ value: typing.Optional[typing.Any] = None
235
+
236
+ #: One or more related nodes, if applicable.
237
+ related_nodes: typing.Optional[typing.List[AXRelatedNode]] = None
238
+
239
+ #: The sources which contributed to the computation of this property.
240
+ sources: typing.Optional[typing.List[AXValueSource]] = None
241
+
242
+ def to_json(self) -> T_JSON_DICT:
243
+ json: T_JSON_DICT = dict()
244
+ json['type'] = self.type_.to_json()
245
+ if self.value is not None:
246
+ json['value'] = self.value
247
+ if self.related_nodes is not None:
248
+ json['relatedNodes'] = [i.to_json() for i in self.related_nodes]
249
+ if self.sources is not None:
250
+ json['sources'] = [i.to_json() for i in self.sources]
251
+ return json
252
+
253
+ @classmethod
254
+ def from_json(cls, json: T_JSON_DICT) -> AXValue:
255
+ return cls(
256
+ type_=AXValueType.from_json(json['type']),
257
+ value=json['value'] if json.get('value', None) is not None else None,
258
+ related_nodes=[AXRelatedNode.from_json(i) for i in json['relatedNodes']] if json.get('relatedNodes', None) is not None else None,
259
+ sources=[AXValueSource.from_json(i) for i in json['sources']] if json.get('sources', None) is not None else None,
260
+ )
261
+
262
+
263
+ class AXPropertyName(enum.Enum):
264
+ '''
265
+ Values of AXProperty name:
266
+ - from 'busy' to 'roledescription': states which apply to every AX node
267
+ - from 'live' to 'root': attributes which apply to nodes in live regions
268
+ - from 'autocomplete' to 'valuetext': attributes which apply to widgets
269
+ - from 'checked' to 'selected': states which apply to widgets
270
+ - from 'activedescendant' to 'owns': relationships between elements other than parent/child/sibling
271
+ - from 'activeFullscreenElement' to 'uninteresting': reasons why this noode is hidden
272
+ '''
273
+ ACTIONS = "actions"
274
+ BUSY = "busy"
275
+ DISABLED = "disabled"
276
+ EDITABLE = "editable"
277
+ FOCUSABLE = "focusable"
278
+ FOCUSED = "focused"
279
+ HIDDEN = "hidden"
280
+ HIDDEN_ROOT = "hiddenRoot"
281
+ INVALID = "invalid"
282
+ KEYSHORTCUTS = "keyshortcuts"
283
+ SETTABLE = "settable"
284
+ ROLEDESCRIPTION = "roledescription"
285
+ LIVE = "live"
286
+ ATOMIC = "atomic"
287
+ RELEVANT = "relevant"
288
+ ROOT = "root"
289
+ AUTOCOMPLETE = "autocomplete"
290
+ HAS_POPUP = "hasPopup"
291
+ LEVEL = "level"
292
+ MULTISELECTABLE = "multiselectable"
293
+ ORIENTATION = "orientation"
294
+ MULTILINE = "multiline"
295
+ READONLY = "readonly"
296
+ REQUIRED = "required"
297
+ VALUEMIN = "valuemin"
298
+ VALUEMAX = "valuemax"
299
+ VALUETEXT = "valuetext"
300
+ CHECKED = "checked"
301
+ EXPANDED = "expanded"
302
+ MODAL = "modal"
303
+ PRESSED = "pressed"
304
+ SELECTED = "selected"
305
+ ACTIVEDESCENDANT = "activedescendant"
306
+ CONTROLS = "controls"
307
+ DESCRIBEDBY = "describedby"
308
+ DETAILS = "details"
309
+ ERRORMESSAGE = "errormessage"
310
+ FLOWTO = "flowto"
311
+ LABELLEDBY = "labelledby"
312
+ OWNS = "owns"
313
+ URL = "url"
314
+ ACTIVE_FULLSCREEN_ELEMENT = "activeFullscreenElement"
315
+ ACTIVE_MODAL_DIALOG = "activeModalDialog"
316
+ ACTIVE_ARIA_MODAL_DIALOG = "activeAriaModalDialog"
317
+ ARIA_HIDDEN_ELEMENT = "ariaHiddenElement"
318
+ ARIA_HIDDEN_SUBTREE = "ariaHiddenSubtree"
319
+ EMPTY_ALT = "emptyAlt"
320
+ EMPTY_TEXT = "emptyText"
321
+ INERT_ELEMENT = "inertElement"
322
+ INERT_SUBTREE = "inertSubtree"
323
+ LABEL_CONTAINER = "labelContainer"
324
+ LABEL_FOR = "labelFor"
325
+ NOT_RENDERED = "notRendered"
326
+ NOT_VISIBLE = "notVisible"
327
+ PRESENTATIONAL_ROLE = "presentationalRole"
328
+ PROBABLY_PRESENTATIONAL = "probablyPresentational"
329
+ INACTIVE_CAROUSEL_TAB_CONTENT = "inactiveCarouselTabContent"
330
+ UNINTERESTING = "uninteresting"
331
+
332
+ def to_json(self) -> str:
333
+ return self.value
334
+
335
+ @classmethod
336
+ def from_json(cls, json: str) -> AXPropertyName:
337
+ return cls(json)
338
+
339
+
340
+ @dataclass
341
+ class AXNode:
342
+ '''
343
+ A node in the accessibility tree.
344
+ '''
345
+ #: Unique identifier for this node.
346
+ node_id: AXNodeId
347
+
348
+ #: Whether this node is ignored for accessibility
349
+ ignored: bool
350
+
351
+ #: Collection of reasons why this node is hidden.
352
+ ignored_reasons: typing.Optional[typing.List[AXProperty]] = None
353
+
354
+ #: This ``Node``'s role, whether explicit or implicit.
355
+ role: typing.Optional[AXValue] = None
356
+
357
+ #: This ``Node``'s Chrome raw role.
358
+ chrome_role: typing.Optional[AXValue] = None
359
+
360
+ #: The accessible name for this ``Node``.
361
+ name: typing.Optional[AXValue] = None
362
+
363
+ #: The accessible description for this ``Node``.
364
+ description: typing.Optional[AXValue] = None
365
+
366
+ #: The value for this ``Node``.
367
+ value: typing.Optional[AXValue] = None
368
+
369
+ #: All other properties
370
+ properties: typing.Optional[typing.List[AXProperty]] = None
371
+
372
+ #: ID for this node's parent.
373
+ parent_id: typing.Optional[AXNodeId] = None
374
+
375
+ #: IDs for each of this node's child nodes.
376
+ child_ids: typing.Optional[typing.List[AXNodeId]] = None
377
+
378
+ #: The backend ID for the associated DOM node, if any.
379
+ backend_dom_node_id: typing.Optional[dom.BackendNodeId] = None
380
+
381
+ #: The frame ID for the frame associated with this nodes document.
382
+ frame_id: typing.Optional[page.FrameId] = None
383
+
384
+ def to_json(self) -> T_JSON_DICT:
385
+ json: T_JSON_DICT = dict()
386
+ json['nodeId'] = self.node_id.to_json()
387
+ json['ignored'] = self.ignored
388
+ if self.ignored_reasons is not None:
389
+ json['ignoredReasons'] = [i.to_json() for i in self.ignored_reasons]
390
+ if self.role is not None:
391
+ json['role'] = self.role.to_json()
392
+ if self.chrome_role is not None:
393
+ json['chromeRole'] = self.chrome_role.to_json()
394
+ if self.name is not None:
395
+ json['name'] = self.name.to_json()
396
+ if self.description is not None:
397
+ json['description'] = self.description.to_json()
398
+ if self.value is not None:
399
+ json['value'] = self.value.to_json()
400
+ if self.properties is not None:
401
+ json['properties'] = [i.to_json() for i in self.properties]
402
+ if self.parent_id is not None:
403
+ json['parentId'] = self.parent_id.to_json()
404
+ if self.child_ids is not None:
405
+ json['childIds'] = [i.to_json() for i in self.child_ids]
406
+ if self.backend_dom_node_id is not None:
407
+ json['backendDOMNodeId'] = self.backend_dom_node_id.to_json()
408
+ if self.frame_id is not None:
409
+ json['frameId'] = self.frame_id.to_json()
410
+ return json
411
+
412
+ @classmethod
413
+ def from_json(cls, json: T_JSON_DICT) -> AXNode:
414
+ return cls(
415
+ node_id=AXNodeId.from_json(json['nodeId']),
416
+ ignored=bool(json['ignored']),
417
+ ignored_reasons=[AXProperty.from_json(i) for i in json['ignoredReasons']] if json.get('ignoredReasons', None) is not None else None,
418
+ role=AXValue.from_json(json['role']) if json.get('role', None) is not None else None,
419
+ chrome_role=AXValue.from_json(json['chromeRole']) if json.get('chromeRole', None) is not None else None,
420
+ name=AXValue.from_json(json['name']) if json.get('name', None) is not None else None,
421
+ description=AXValue.from_json(json['description']) if json.get('description', None) is not None else None,
422
+ value=AXValue.from_json(json['value']) if json.get('value', None) is not None else None,
423
+ properties=[AXProperty.from_json(i) for i in json['properties']] if json.get('properties', None) is not None else None,
424
+ parent_id=AXNodeId.from_json(json['parentId']) if json.get('parentId', None) is not None else None,
425
+ child_ids=[AXNodeId.from_json(i) for i in json['childIds']] if json.get('childIds', None) is not None else None,
426
+ backend_dom_node_id=dom.BackendNodeId.from_json(json['backendDOMNodeId']) if json.get('backendDOMNodeId', None) is not None else None,
427
+ frame_id=page.FrameId.from_json(json['frameId']) if json.get('frameId', None) is not None else None,
428
+ )
429
+
430
+
431
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
432
+ '''
433
+ Disables the accessibility domain.
434
+ '''
435
+ cmd_dict: T_JSON_DICT = {
436
+ 'method': 'Accessibility.disable',
437
+ }
438
+ json = yield cmd_dict
439
+
440
+
441
+ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
442
+ '''
443
+ Enables the accessibility domain which causes ``AXNodeId``'s to remain consistent between method calls.
444
+ This turns on accessibility for the page, which can impact performance until accessibility is disabled.
445
+ '''
446
+ cmd_dict: T_JSON_DICT = {
447
+ 'method': 'Accessibility.enable',
448
+ }
449
+ json = yield cmd_dict
450
+
451
+
452
+ def get_partial_ax_tree(
453
+ node_id: typing.Optional[dom.NodeId] = None,
454
+ backend_node_id: typing.Optional[dom.BackendNodeId] = None,
455
+ object_id: typing.Optional[runtime.RemoteObjectId] = None,
456
+ fetch_relatives: typing.Optional[bool] = None
457
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]:
458
+ '''
459
+ Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
460
+
461
+ **EXPERIMENTAL**
462
+
463
+ :param node_id: *(Optional)* Identifier of the node to get the partial accessibility tree for.
464
+ :param backend_node_id: *(Optional)* Identifier of the backend node to get the partial accessibility tree for.
465
+ :param object_id: *(Optional)* JavaScript object id of the node wrapper to get the partial accessibility tree for.
466
+ :param fetch_relatives: *(Optional)* Whether to fetch this node's ancestors, siblings and children. Defaults to true.
467
+ :returns: The ``Accessibility.AXNode`` for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
468
+ '''
469
+ params: T_JSON_DICT = dict()
470
+ if node_id is not None:
471
+ params['nodeId'] = node_id.to_json()
472
+ if backend_node_id is not None:
473
+ params['backendNodeId'] = backend_node_id.to_json()
474
+ if object_id is not None:
475
+ params['objectId'] = object_id.to_json()
476
+ if fetch_relatives is not None:
477
+ params['fetchRelatives'] = fetch_relatives
478
+ cmd_dict: T_JSON_DICT = {
479
+ 'method': 'Accessibility.getPartialAXTree',
480
+ 'params': params,
481
+ }
482
+ json = yield cmd_dict
483
+ return [AXNode.from_json(i) for i in json['nodes']]
484
+
485
+
486
+ def get_full_ax_tree(
487
+ depth: typing.Optional[int] = None,
488
+ frame_id: typing.Optional[page.FrameId] = None
489
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]:
490
+ '''
491
+ Fetches the entire accessibility tree for the root Document
492
+
493
+ **EXPERIMENTAL**
494
+
495
+ :param depth: *(Optional)* The maximum depth at which descendants of the root node should be retrieved. If omitted, the full tree is returned.
496
+ :param frame_id: *(Optional)* The frame for whose document the AX tree should be retrieved. If omitted, the root frame is used.
497
+ :returns:
498
+ '''
499
+ params: T_JSON_DICT = dict()
500
+ if depth is not None:
501
+ params['depth'] = depth
502
+ if frame_id is not None:
503
+ params['frameId'] = frame_id.to_json()
504
+ cmd_dict: T_JSON_DICT = {
505
+ 'method': 'Accessibility.getFullAXTree',
506
+ 'params': params,
507
+ }
508
+ json = yield cmd_dict
509
+ return [AXNode.from_json(i) for i in json['nodes']]
510
+
511
+
512
+ def get_root_ax_node(
513
+ frame_id: typing.Optional[page.FrameId] = None
514
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,AXNode]:
515
+ '''
516
+ Fetches the root node.
517
+ Requires ``enable()`` to have been called previously.
518
+
519
+ **EXPERIMENTAL**
520
+
521
+ :param frame_id: *(Optional)* The frame in whose document the node resides. If omitted, the root frame is used.
522
+ :returns:
523
+ '''
524
+ params: T_JSON_DICT = dict()
525
+ if frame_id is not None:
526
+ params['frameId'] = frame_id.to_json()
527
+ cmd_dict: T_JSON_DICT = {
528
+ 'method': 'Accessibility.getRootAXNode',
529
+ 'params': params,
530
+ }
531
+ json = yield cmd_dict
532
+ return AXNode.from_json(json['node'])
533
+
534
+
535
+ def get_ax_node_and_ancestors(
536
+ node_id: typing.Optional[dom.NodeId] = None,
537
+ backend_node_id: typing.Optional[dom.BackendNodeId] = None,
538
+ object_id: typing.Optional[runtime.RemoteObjectId] = None
539
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]:
540
+ '''
541
+ Fetches a node and all ancestors up to and including the root.
542
+ Requires ``enable()`` to have been called previously.
543
+
544
+ **EXPERIMENTAL**
545
+
546
+ :param node_id: *(Optional)* Identifier of the node to get.
547
+ :param backend_node_id: *(Optional)* Identifier of the backend node to get.
548
+ :param object_id: *(Optional)* JavaScript object id of the node wrapper to get.
549
+ :returns:
550
+ '''
551
+ params: T_JSON_DICT = dict()
552
+ if node_id is not None:
553
+ params['nodeId'] = node_id.to_json()
554
+ if backend_node_id is not None:
555
+ params['backendNodeId'] = backend_node_id.to_json()
556
+ if object_id is not None:
557
+ params['objectId'] = object_id.to_json()
558
+ cmd_dict: T_JSON_DICT = {
559
+ 'method': 'Accessibility.getAXNodeAndAncestors',
560
+ 'params': params,
561
+ }
562
+ json = yield cmd_dict
563
+ return [AXNode.from_json(i) for i in json['nodes']]
564
+
565
+
566
+ def get_child_ax_nodes(
567
+ id_: AXNodeId,
568
+ frame_id: typing.Optional[page.FrameId] = None
569
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]:
570
+ '''
571
+ Fetches a particular accessibility node by AXNodeId.
572
+ Requires ``enable()`` to have been called previously.
573
+
574
+ **EXPERIMENTAL**
575
+
576
+ :param id_:
577
+ :param frame_id: *(Optional)* The frame in whose document the node resides. If omitted, the root frame is used.
578
+ :returns:
579
+ '''
580
+ params: T_JSON_DICT = dict()
581
+ params['id'] = id_.to_json()
582
+ if frame_id is not None:
583
+ params['frameId'] = frame_id.to_json()
584
+ cmd_dict: T_JSON_DICT = {
585
+ 'method': 'Accessibility.getChildAXNodes',
586
+ 'params': params,
587
+ }
588
+ json = yield cmd_dict
589
+ return [AXNode.from_json(i) for i in json['nodes']]
590
+
591
+
592
+ def query_ax_tree(
593
+ node_id: typing.Optional[dom.NodeId] = None,
594
+ backend_node_id: typing.Optional[dom.BackendNodeId] = None,
595
+ object_id: typing.Optional[runtime.RemoteObjectId] = None,
596
+ accessible_name: typing.Optional[str] = None,
597
+ role: typing.Optional[str] = None
598
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]:
599
+ '''
600
+ Query a DOM node's accessibility subtree for accessible name and role.
601
+ This command computes the name and role for all nodes in the subtree, including those that are
602
+ ignored for accessibility, and returns those that match the specified name and role. If no DOM
603
+ node is specified, or the DOM node does not exist, the command returns an error. If neither
604
+ ``accessibleName`` or ``role`` is specified, it returns all the accessibility nodes in the subtree.
605
+
606
+ **EXPERIMENTAL**
607
+
608
+ :param node_id: *(Optional)* Identifier of the node for the root to query.
609
+ :param backend_node_id: *(Optional)* Identifier of the backend node for the root to query.
610
+ :param object_id: *(Optional)* JavaScript object id of the node wrapper for the root to query.
611
+ :param accessible_name: *(Optional)* Find nodes with this computed name.
612
+ :param role: *(Optional)* Find nodes with this computed role.
613
+ :returns: A list of ``Accessibility.AXNode`` matching the specified attributes, including nodes that are ignored for accessibility.
614
+ '''
615
+ params: T_JSON_DICT = dict()
616
+ if node_id is not None:
617
+ params['nodeId'] = node_id.to_json()
618
+ if backend_node_id is not None:
619
+ params['backendNodeId'] = backend_node_id.to_json()
620
+ if object_id is not None:
621
+ params['objectId'] = object_id.to_json()
622
+ if accessible_name is not None:
623
+ params['accessibleName'] = accessible_name
624
+ if role is not None:
625
+ params['role'] = role
626
+ cmd_dict: T_JSON_DICT = {
627
+ 'method': 'Accessibility.queryAXTree',
628
+ 'params': params,
629
+ }
630
+ json = yield cmd_dict
631
+ return [AXNode.from_json(i) for i in json['nodes']]
632
+
633
+
634
+ @event_class('Accessibility.loadComplete')
635
+ @dataclass
636
+ class LoadComplete:
637
+ '''
638
+ **EXPERIMENTAL**
639
+
640
+ The loadComplete event mirrors the load complete event sent by the browser to assistive
641
+ technology when the web page has finished loading.
642
+ '''
643
+ #: New document root node.
644
+ root: AXNode
645
+
646
+ @classmethod
647
+ def from_json(cls, json: T_JSON_DICT) -> LoadComplete:
648
+ return cls(
649
+ root=AXNode.from_json(json['root'])
650
+ )
651
+
652
+
653
+ @event_class('Accessibility.nodesUpdated')
654
+ @dataclass
655
+ class NodesUpdated:
656
+ '''
657
+ **EXPERIMENTAL**
658
+
659
+ The nodesUpdated event is sent every time a previously requested node has changed the in tree.
660
+ '''
661
+ #: Updated node data.
662
+ nodes: typing.List[AXNode]
663
+
664
+ @classmethod
665
+ def from_json(cls, json: T_JSON_DICT) -> NodesUpdated:
666
+ return cls(
667
+ nodes=[AXNode.from_json(i) for i in json['nodes']]
668
+ )