Skip to content

Commit f58d7c5

Browse files
authored
Merge pull request #19 from eNcacz/master
Update to CDP r953906
2 parents f41ca68 + 6b30e52 commit f58d7c5

51 files changed

Lines changed: 2188 additions & 842 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

generator/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def generate_command(module: types.ModuleType, module_name: str,
108108

109109
# Copy docstring.
110110
if fn.__doc__:
111-
doc = " '''" + fn.__doc__ + "'''\n"
111+
doc = " r'''" + fn.__doc__ + "'''\n"
112112
else:
113113
doc = ''
114114

generator/test_generate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async def query_selector(
1212
node_id: NodeId,
1313
selector: str
1414
) -> NodeId:
15-
'''
15+
r'''
1616
Executes ``querySelector`` on a given node.
1717
1818
:param node_id: Id of the node to query upon.
@@ -29,7 +29,7 @@ async def query_selector(
2929
def test_accessibility_disable():
3030
expected = dedent("""\
3131
async def disable() -> None:
32-
'''
32+
r'''
3333
Disables the accessibility domain.
3434
'''
3535
session = get_session_context('accessibility.disable')
@@ -48,7 +48,7 @@ async def get_partial_ax_tree(
4848
object_id: typing.Optional[cdp.runtime.RemoteObjectId] = None,
4949
fetch_relatives: typing.Optional[bool] = None
5050
) -> typing.List[AXNode]:
51-
'''
51+
r'''
5252
Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
5353
5454
**EXPERIMENTAL**
@@ -64,4 +64,4 @@ async def get_partial_ax_tree(
6464
""")
6565

6666
assert expected == generate_command(cdp.accessibility, 'accessibility',
67-
cdp.accessibility.get_partial_ax_tree)
67+
cdp.accessibility.get_partial_ax_tree)

tests/test_trio_cdp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ async def handler(request):
4747
'title': 'New Tab',
4848
'url': 'about:newtab',
4949
'attached': False,
50+
'canAccessOpener': False,
5051
}],
5152
}
5253
}

trio_cdp/generated/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from . import accessibility
77
from . import animation
8-
from . import application_cache
98
from . import audits
109
from . import background_service
1110
from . import browser
@@ -21,6 +20,7 @@
2120
from . import dom_snapshot
2221
from . import dom_storage
2322
from . import emulation
23+
from . import event_breakpoints
2424
from . import fetch
2525
from . import headless_experimental
2626
from . import heap_profiler
@@ -30,11 +30,13 @@
3030
from . import io
3131
from . import layer_tree
3232
from . import log
33+
from . import media
3334
from . import memory
3435
from . import network
3536
from . import overlay
3637
from . import page
3738
from . import performance
39+
from . import performance_timeline
3840
from . import profiler
3941
from . import runtime
4042
from . import schema

trio_cdp/generated/accessibility.py

Lines changed: 97 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,84 @@
1919
AXValueNativeSourceType,
2020
AXValueSource,
2121
AXValueSourceType,
22-
AXValueType
22+
AXValueType,
23+
LoadComplete,
24+
NodesUpdated
2325
)
2426

2527

2628
async def disable() -> None:
27-
'''
29+
r'''
2830
Disables the accessibility domain.
2931
'''
3032
session = get_session_context('accessibility.disable')
3133
return await session.execute(cdp.accessibility.disable())
3234

3335

3436
async def enable() -> None:
35-
'''
37+
r'''
3638
Enables the accessibility domain which causes ``AXNodeId``'s to remain consistent between method calls.
3739
This turns on accessibility for the page, which can impact performance until accessibility is disabled.
3840
'''
3941
session = get_session_context('accessibility.enable')
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+
r'''
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:
4460
'''
45-
Fetches the entire accessibility tree
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+
r'''
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]:
88+
r'''
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

55102
async def get_partial_ax_tree(
@@ -58,7 +105,7 @@ async def get_partial_ax_tree(
58105
object_id: typing.Optional[cdp.runtime.RemoteObjectId] = None,
59106
fetch_relatives: typing.Optional[bool] = None
60107
) -> typing.List[AXNode]:
61-
'''
108+
r'''
62109
Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
63110
64111
**EXPERIMENTAL**
@@ -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+
r'''
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+
r'''
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))

trio_cdp/generated/animation.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121

2222

2323
async def disable() -> None:
24-
'''
24+
r'''
2525
Disables animation domain notifications.
2626
'''
2727
session = get_session_context('animation.disable')
2828
return await session.execute(cdp.animation.disable())
2929

3030

3131
async def enable() -> None:
32-
'''
32+
r'''
3333
Enables animation domain notifications.
3434
'''
3535
session = get_session_context('animation.enable')
@@ -39,7 +39,7 @@ async def enable() -> None:
3939
async def get_current_time(
4040
id_: str
4141
) -> float:
42-
'''
42+
r'''
4343
Returns the current time of the an animation.
4444
4545
:param id_: Id of animation.
@@ -50,7 +50,7 @@ async def get_current_time(
5050

5151

5252
async def get_playback_rate() -> float:
53-
'''
53+
r'''
5454
Gets the playback rate of the document timeline.
5555
5656
:returns: Playback rate for animations on page.
@@ -62,7 +62,7 @@ async def get_playback_rate() -> float:
6262
async def release_animations(
6363
animations: typing.List[str]
6464
) -> None:
65-
'''
65+
r'''
6666
Releases a set of animations to no longer be manipulated.
6767
6868
:param animations: List of animation ids to seek.
@@ -74,7 +74,7 @@ async def release_animations(
7474
async def resolve_animation(
7575
animation_id: str
7676
) -> cdp.runtime.RemoteObject:
77-
'''
77+
r'''
7878
Gets the remote object of the Animation.
7979
8080
:param animation_id: Animation id.
@@ -88,7 +88,7 @@ async def seek_animations(
8888
animations: typing.List[str],
8989
current_time: float
9090
) -> None:
91-
'''
91+
r'''
9292
Seek a set of animations to a particular time within each animation.
9393
9494
:param animations: List of animation ids to seek.
@@ -102,7 +102,7 @@ async def set_paused(
102102
animations: typing.List[str],
103103
paused: bool
104104
) -> None:
105-
'''
105+
r'''
106106
Sets the paused state of a set of animations.
107107
108108
:param animations: Animations to set the pause state of.
@@ -115,7 +115,7 @@ async def set_paused(
115115
async def set_playback_rate(
116116
playback_rate: float
117117
) -> None:
118-
'''
118+
r'''
119119
Sets the playback rate of the document timeline.
120120
121121
:param playback_rate: Playback rate for animations on page
@@ -129,7 +129,7 @@ async def set_timing(
129129
duration: float,
130130
delay: float
131131
) -> None:
132-
'''
132+
r'''
133133
Sets the timing of an animation node.
134134
135135
:param animation_id: Animation id.

trio_cdp/generated/application_cache.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)