1919 AXValueNativeSourceType ,
2020 AXValueSource ,
2121 AXValueSourceType ,
22- AXValueType
22+ AXValueType ,
23+ LoadComplete ,
24+ NodesUpdated
2325)
2426
2527
@@ -40,16 +42,61 @@ async def enable() -> None:
4042 return await session .execute (cdp .accessibility .enable ())
4143
4244
43- async def get_full_ax_tree () -> typing .List [AXNode ]:
45+ async def get_ax_node_and_ancestors (
46+ node_id : typing .Optional [cdp .dom .NodeId ] = None ,
47+ backend_node_id : typing .Optional [cdp .dom .BackendNodeId ] = None ,
48+ object_id : typing .Optional [cdp .runtime .RemoteObjectId ] = None
49+ ) -> typing .List [AXNode ]:
50+ '''
51+ Fetches a node and all ancestors up to and including the root.
52+ Requires ``enable()`` to have been called previously.
53+
54+ **EXPERIMENTAL**
55+
56+ :param node_id: *(Optional)* Identifier of the node to get.
57+ :param backend_node_id: *(Optional)* Identifier of the backend node to get.
58+ :param object_id: *(Optional)* JavaScript object id of the node wrapper to get.
59+ :returns:
60+ '''
61+ session = get_session_context ('accessibility.get_ax_node_and_ancestors' )
62+ return await session .execute (cdp .accessibility .get_ax_node_and_ancestors (node_id , backend_node_id , object_id ))
63+
64+
65+ async def get_child_ax_nodes (
66+ id_ : AXNodeId ,
67+ frame_id : typing .Optional [cdp .page .FrameId ] = None
68+ ) -> typing .List [AXNode ]:
69+ '''
70+ Fetches a particular accessibility node by AXNodeId.
71+ Requires ``enable()`` to have been called previously.
72+
73+ **EXPERIMENTAL**
74+
75+ :param id_:
76+ :param frame_id: *(Optional)* The frame in whose document the node resides. If omitted, the root frame is used.
77+ :returns:
78+ '''
79+ session = get_session_context ('accessibility.get_child_ax_nodes' )
80+ return await session .execute (cdp .accessibility .get_child_ax_nodes (id_ , frame_id ))
81+
82+
83+ async def get_full_ax_tree (
84+ depth : typing .Optional [int ] = None ,
85+ max_depth : typing .Optional [int ] = None ,
86+ frame_id : typing .Optional [cdp .page .FrameId ] = None
87+ ) -> typing .List [AXNode ]:
4488 '''
45- Fetches the entire accessibility tree
89+ Fetches the entire accessibility tree for the root Document
4690
4791 **EXPERIMENTAL**
4892
93+ :param depth: *(Optional)* The maximum depth at which descendants of the root node should be retrieved. If omitted, the full tree is returned.
94+ :param max_depth: **(DEPRECATED)** *(Optional)* Deprecated. This parameter has been renamed to ```depth```. If depth is not provided, max_depth will be used.
95+ :param frame_id: *(Optional)* The frame for whose document the AX tree should be retrieved. If omited, the root frame is used.
4996 :returns:
5097 '''
5198 session = get_session_context ('accessibility.get_full_ax_tree' )
52- return await session .execute (cdp .accessibility .get_full_ax_tree ())
99+ return await session .execute (cdp .accessibility .get_full_ax_tree (depth , max_depth , frame_id ))
53100
54101
55102async def get_partial_ax_tree (
@@ -71,3 +118,46 @@ async def get_partial_ax_tree(
71118 '''
72119 session = get_session_context ('accessibility.get_partial_ax_tree' )
73120 return await session .execute (cdp .accessibility .get_partial_ax_tree (node_id , backend_node_id , object_id , fetch_relatives ))
121+
122+
123+ async def get_root_ax_node (
124+ frame_id : typing .Optional [cdp .page .FrameId ] = None
125+ ) -> AXNode :
126+ '''
127+ Fetches the root node.
128+ Requires ``enable()`` to have been called previously.
129+
130+ **EXPERIMENTAL**
131+
132+ :param frame_id: *(Optional)* The frame in whose document the node resides. If omitted, the root frame is used.
133+ :returns:
134+ '''
135+ session = get_session_context ('accessibility.get_root_ax_node' )
136+ return await session .execute (cdp .accessibility .get_root_ax_node (frame_id ))
137+
138+
139+ async def query_ax_tree (
140+ node_id : typing .Optional [cdp .dom .NodeId ] = None ,
141+ backend_node_id : typing .Optional [cdp .dom .BackendNodeId ] = None ,
142+ object_id : typing .Optional [cdp .runtime .RemoteObjectId ] = None ,
143+ accessible_name : typing .Optional [str ] = None ,
144+ role : typing .Optional [str ] = None
145+ ) -> typing .List [AXNode ]:
146+ '''
147+ Query a DOM node's accessibility subtree for accessible name and role.
148+ This command computes the name and role for all nodes in the subtree, including those that are
149+ ignored for accessibility, and returns those that mactch the specified name and role. If no DOM
150+ node is specified, or the DOM node does not exist, the command returns an error. If neither
151+ ``accessibleName`` or ``role`` is specified, it returns all the accessibility nodes in the subtree.
152+
153+ **EXPERIMENTAL**
154+
155+ :param node_id: *(Optional)* Identifier of the node for the root to query.
156+ :param backend_node_id: *(Optional)* Identifier of the backend node for the root to query.
157+ :param object_id: *(Optional)* JavaScript object id of the node wrapper for the root to query.
158+ :param accessible_name: *(Optional)* Find nodes with this computed name.
159+ :param role: *(Optional)* Find nodes with this computed role.
160+ :returns: A list of ``Accessibility.AXNode`` matching the specified attributes, including nodes that are ignored for accessibility.
161+ '''
162+ session = get_session_context ('accessibility.query_ax_tree' )
163+ return await session .execute (cdp .accessibility .query_ax_tree (node_id , backend_node_id , object_id , accessible_name , role ))
0 commit comments