parsek-cdp 0.1.0__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.
- parsek_cdp/__init__.py +55 -0
- parsek_cdp/_logging.py +49 -0
- parsek_cdp/cdp/__init__.py +247 -0
- parsek_cdp/cdp/accessibility/__init__.py +15 -0
- parsek_cdp/cdp/accessibility/events.py +35 -0
- parsek_cdp/cdp/accessibility/functions.py +202 -0
- parsek_cdp/cdp/accessibility/types.py +235 -0
- parsek_cdp/cdp/animation/__init__.py +15 -0
- parsek_cdp/cdp/animation/events.py +52 -0
- parsek_cdp/cdp/animation/functions.py +140 -0
- parsek_cdp/cdp/animation/types.py +113 -0
- parsek_cdp/cdp/audits/__init__.py +15 -0
- parsek_cdp/cdp/audits/events.py +21 -0
- parsek_cdp/cdp/audits/functions.py +95 -0
- parsek_cdp/cdp/audits/types.py +1051 -0
- parsek_cdp/cdp/autofill/__init__.py +15 -0
- parsek_cdp/cdp/autofill/events.py +27 -0
- parsek_cdp/cdp/autofill/functions.py +64 -0
- parsek_cdp/cdp/autofill/types.py +108 -0
- parsek_cdp/cdp/backgroundservice/__init__.py +15 -0
- parsek_cdp/cdp/backgroundservice/events.py +40 -0
- parsek_cdp/cdp/backgroundservice/functions.py +59 -0
- parsek_cdp/cdp/backgroundservice/types.py +63 -0
- parsek_cdp/cdp/bluetoothemulation/__init__.py +15 -0
- parsek_cdp/cdp/bluetoothemulation/events.py +70 -0
- parsek_cdp/cdp/bluetoothemulation/functions.py +247 -0
- parsek_cdp/cdp/bluetoothemulation/types.py +120 -0
- parsek_cdp/cdp/browser/__init__.py +15 -0
- parsek_cdp/cdp/browser/events.py +46 -0
- parsek_cdp/cdp/browser/functions.py +350 -0
- parsek_cdp/cdp/browser/types.py +158 -0
- parsek_cdp/cdp/cachestorage/__init__.py +15 -0
- parsek_cdp/cdp/cachestorage/events.py +13 -0
- parsek_cdp/cdp/cachestorage/functions.py +126 -0
- parsek_cdp/cdp/cachestorage/types.py +89 -0
- parsek_cdp/cdp/cast/__init__.py +15 -0
- parsek_cdp/cdp/cast/events.py +38 -0
- parsek_cdp/cdp/cast/functions.py +77 -0
- parsek_cdp/cdp/cast/types.py +23 -0
- parsek_cdp/cdp/console/__init__.py +15 -0
- parsek_cdp/cdp/console/events.py +22 -0
- parsek_cdp/cdp/console/functions.py +36 -0
- parsek_cdp/cdp/console/types.py +30 -0
- parsek_cdp/cdp/css/__init__.py +15 -0
- parsek_cdp/cdp/css/events.py +79 -0
- parsek_cdp/cdp/css/functions.py +788 -0
- parsek_cdp/cdp/css/types.py +742 -0
- parsek_cdp/cdp/debugger/__init__.py +15 -0
- parsek_cdp/cdp/debugger/events.py +164 -0
- parsek_cdp/cdp/debugger/functions.py +663 -0
- parsek_cdp/cdp/debugger/types.py +171 -0
- parsek_cdp/cdp/deviceaccess/__init__.py +15 -0
- parsek_cdp/cdp/deviceaccess/events.py +30 -0
- parsek_cdp/cdp/deviceaccess/functions.py +54 -0
- parsek_cdp/cdp/deviceaccess/types.py +28 -0
- parsek_cdp/cdp/deviceorientation/__init__.py +15 -0
- parsek_cdp/cdp/deviceorientation/events.py +13 -0
- parsek_cdp/cdp/deviceorientation/functions.py +35 -0
- parsek_cdp/cdp/deviceorientation/types.py +10 -0
- parsek_cdp/cdp/dom/__init__.py +15 -0
- parsek_cdp/cdp/dom/events.py +228 -0
- parsek_cdp/cdp/dom/functions.py +1033 -0
- parsek_cdp/cdp/dom/types.py +293 -0
- parsek_cdp/cdp/domdebugger/__init__.py +15 -0
- parsek_cdp/cdp/domdebugger/events.py +13 -0
- parsek_cdp/cdp/domdebugger/functions.py +155 -0
- parsek_cdp/cdp/domdebugger/types.py +57 -0
- parsek_cdp/cdp/domsnapshot/__init__.py +15 -0
- parsek_cdp/cdp/domsnapshot/events.py +13 -0
- parsek_cdp/cdp/domsnapshot/functions.py +111 -0
- parsek_cdp/cdp/domsnapshot/types.py +312 -0
- parsek_cdp/cdp/domstorage/__init__.py +15 -0
- parsek_cdp/cdp/domstorage/events.py +60 -0
- parsek_cdp/cdp/domstorage/functions.py +79 -0
- parsek_cdp/cdp/domstorage/types.py +30 -0
- parsek_cdp/cdp/emulation/__init__.py +15 -0
- parsek_cdp/cdp/emulation/events.py +17 -0
- parsek_cdp/cdp/emulation/functions.py +688 -0
- parsek_cdp/cdp/emulation/types.py +305 -0
- parsek_cdp/cdp/eventbreakpoints/__init__.py +15 -0
- parsek_cdp/cdp/eventbreakpoints/events.py +13 -0
- parsek_cdp/cdp/eventbreakpoints/functions.py +41 -0
- parsek_cdp/cdp/eventbreakpoints/types.py +10 -0
- parsek_cdp/cdp/extensions/__init__.py +15 -0
- parsek_cdp/cdp/extensions/events.py +13 -0
- parsek_cdp/cdp/extensions/functions.py +118 -0
- parsek_cdp/cdp/extensions/types.py +19 -0
- parsek_cdp/cdp/fedcm/__init__.py +15 -0
- parsek_cdp/cdp/fedcm/events.py +45 -0
- parsek_cdp/cdp/fedcm/functions.py +93 -0
- parsek_cdp/cdp/fedcm/types.py +72 -0
- parsek_cdp/cdp/fetch/__init__.py +15 -0
- parsek_cdp/cdp/fetch/events.py +82 -0
- parsek_cdp/cdp/fetch/functions.py +215 -0
- parsek_cdp/cdp/fetch/types.py +81 -0
- parsek_cdp/cdp/filesystem/__init__.py +15 -0
- parsek_cdp/cdp/filesystem/events.py +13 -0
- parsek_cdp/cdp/filesystem/functions.py +36 -0
- parsek_cdp/cdp/filesystem/types.py +54 -0
- parsek_cdp/cdp/headlessexperimental/__init__.py +15 -0
- parsek_cdp/cdp/headlessexperimental/events.py +13 -0
- parsek_cdp/cdp/headlessexperimental/functions.py +77 -0
- parsek_cdp/cdp/headlessexperimental/types.py +24 -0
- parsek_cdp/cdp/heapprofiler/__init__.py +15 -0
- parsek_cdp/cdp/heapprofiler/events.py +65 -0
- parsek_cdp/cdp/heapprofiler/functions.py +193 -0
- parsek_cdp/cdp/heapprofiler/types.py +57 -0
- parsek_cdp/cdp/indexeddb/__init__.py +15 -0
- parsek_cdp/cdp/indexeddb/events.py +13 -0
- parsek_cdp/cdp/indexeddb/functions.py +232 -0
- parsek_cdp/cdp/indexeddb/types.py +120 -0
- parsek_cdp/cdp/input/__init__.py +15 -0
- parsek_cdp/cdp/input/events.py +25 -0
- parsek_cdp/cdp/input/functions.py +361 -0
- parsek_cdp/cdp/input/types.py +87 -0
- parsek_cdp/cdp/inspector/__init__.py +15 -0
- parsek_cdp/cdp/inspector/events.py +41 -0
- parsek_cdp/cdp/inspector/functions.py +27 -0
- parsek_cdp/cdp/inspector/types.py +10 -0
- parsek_cdp/cdp/io/__init__.py +15 -0
- parsek_cdp/cdp/io/events.py +13 -0
- parsek_cdp/cdp/io/functions.py +77 -0
- parsek_cdp/cdp/io/types.py +13 -0
- parsek_cdp/cdp/layertree/__init__.py +15 -0
- parsek_cdp/cdp/layertree/events.py +36 -0
- parsek_cdp/cdp/layertree/functions.py +178 -0
- parsek_cdp/cdp/layertree/types.py +104 -0
- parsek_cdp/cdp/log/__init__.py +15 -0
- parsek_cdp/cdp/log/events.py +22 -0
- parsek_cdp/cdp/log/functions.py +54 -0
- parsek_cdp/cdp/log/types.py +57 -0
- parsek_cdp/cdp/media/__init__.py +15 -0
- parsek_cdp/cdp/media/events.py +87 -0
- parsek_cdp/cdp/media/functions.py +27 -0
- parsek_cdp/cdp/media/types.py +101 -0
- parsek_cdp/cdp/memory/__init__.py +15 -0
- parsek_cdp/cdp/memory/events.py +13 -0
- parsek_cdp/cdp/memory/functions.py +164 -0
- parsek_cdp/cdp/memory/types.py +71 -0
- parsek_cdp/cdp/mixins/__init__.py +21 -0
- parsek_cdp/cdp/mixins/datatype.py +123 -0
- parsek_cdp/cdp/mixins/event.py +78 -0
- parsek_cdp/cdp/mixins/namespace.py +31 -0
- parsek_cdp/cdp/network/__init__.py +15 -0
- parsek_cdp/cdp/network/events.py +726 -0
- parsek_cdp/cdp/network/functions.py +734 -0
- parsek_cdp/cdp/network/types.py +1247 -0
- parsek_cdp/cdp/overlay/__init__.py +15 -0
- parsek_cdp/cdp/overlay/events.py +54 -0
- parsek_cdp/cdp/overlay/functions.py +407 -0
- parsek_cdp/cdp/overlay/types.py +328 -0
- parsek_cdp/cdp/page/__init__.py +15 -0
- parsek_cdp/cdp/page/events.py +416 -0
- parsek_cdp/cdp/page/functions.py +1081 -0
- parsek_cdp/cdp/page/types.py +1088 -0
- parsek_cdp/cdp/performance/__init__.py +15 -0
- parsek_cdp/cdp/performance/events.py +24 -0
- parsek_cdp/cdp/performance/functions.py +63 -0
- parsek_cdp/cdp/performance/types.py +22 -0
- parsek_cdp/cdp/performancetimeline/__init__.py +15 -0
- parsek_cdp/cdp/performancetimeline/events.py +22 -0
- parsek_cdp/cdp/performancetimeline/functions.py +30 -0
- parsek_cdp/cdp/performancetimeline/types.py +85 -0
- parsek_cdp/cdp/preload/__init__.py +15 -0
- parsek_cdp/cdp/preload/events.py +116 -0
- parsek_cdp/cdp/preload/functions.py +25 -0
- parsek_cdp/cdp/preload/types.py +267 -0
- parsek_cdp/cdp/profiler/__init__.py +15 -0
- parsek_cdp/cdp/profiler/events.py +64 -0
- parsek_cdp/cdp/profiler/functions.py +134 -0
- parsek_cdp/cdp/profiler/types.py +105 -0
- parsek_cdp/cdp/pwa/__init__.py +15 -0
- parsek_cdp/cdp/pwa/events.py +13 -0
- parsek_cdp/cdp/pwa/functions.py +196 -0
- parsek_cdp/cdp/pwa/types.py +45 -0
- parsek_cdp/cdp/runtime/__init__.py +15 -0
- parsek_cdp/cdp/runtime/events.py +123 -0
- parsek_cdp/cdp/runtime/functions.py +552 -0
- parsek_cdp/cdp/runtime/types.py +319 -0
- parsek_cdp/cdp/schema/__init__.py +15 -0
- parsek_cdp/cdp/schema/events.py +13 -0
- parsek_cdp/cdp/schema/functions.py +32 -0
- parsek_cdp/cdp/schema/types.py +22 -0
- parsek_cdp/cdp/security/__init__.py +15 -0
- parsek_cdp/cdp/security/events.py +64 -0
- parsek_cdp/cdp/security/functions.py +66 -0
- parsek_cdp/cdp/security/types.py +168 -0
- parsek_cdp/cdp/serviceworker/__init__.py +15 -0
- parsek_cdp/cdp/serviceworker/events.py +43 -0
- parsek_cdp/cdp/serviceworker/functions.py +115 -0
- parsek_cdp/cdp/serviceworker/types.py +95 -0
- parsek_cdp/cdp/storage/__init__.py +15 -0
- parsek_cdp/cdp/storage/events.py +288 -0
- parsek_cdp/cdp/storage/functions.py +571 -0
- parsek_cdp/cdp/storage/types.py +656 -0
- parsek_cdp/cdp/systeminfo/__init__.py +15 -0
- parsek_cdp/cdp/systeminfo/events.py +13 -0
- parsek_cdp/cdp/systeminfo/functions.py +75 -0
- parsek_cdp/cdp/systeminfo/types.py +132 -0
- parsek_cdp/cdp/target/__init__.py +15 -0
- parsek_cdp/cdp/target/events.py +109 -0
- parsek_cdp/cdp/target/functions.py +424 -0
- parsek_cdp/cdp/target/types.py +83 -0
- parsek_cdp/cdp/tethering/__init__.py +15 -0
- parsek_cdp/cdp/tethering/events.py +22 -0
- parsek_cdp/cdp/tethering/functions.py +35 -0
- parsek_cdp/cdp/tethering/types.py +10 -0
- parsek_cdp/cdp/tracing/__init__.py +15 -0
- parsek_cdp/cdp/tracing/events.py +61 -0
- parsek_cdp/cdp/tracing/functions.py +119 -0
- parsek_cdp/cdp/tracing/types.py +81 -0
- parsek_cdp/cdp/webaudio/__init__.py +15 -0
- parsek_cdp/cdp/webaudio/events.py +184 -0
- parsek_cdp/cdp/webaudio/functions.py +51 -0
- parsek_cdp/cdp/webaudio/types.py +155 -0
- parsek_cdp/cdp/webauthn/__init__.py +15 -0
- parsek_cdp/cdp/webauthn/events.py +69 -0
- parsek_cdp/cdp/webauthn/functions.py +214 -0
- parsek_cdp/cdp/webauthn/types.py +96 -0
- parsek_cdp/core/__init__.py +18 -0
- parsek_cdp/core/browser.py +240 -0
- parsek_cdp/core/browser_context.py +58 -0
- parsek_cdp/core/element.py +405 -0
- parsek_cdp/core/feature.py +376 -0
- parsek_cdp/core/frame.py +351 -0
- parsek_cdp/core/pagable.py +175 -0
- parsek_cdp/core/page.py +163 -0
- parsek_cdp/core/target.py +490 -0
- parsek_cdp/features/__init__.py +14 -0
- parsek_cdp/features/request_listener/__init__.py +256 -0
- parsek_cdp/features/request_listener/events.py +48 -0
- parsek_cdp/features/request_listener/types.py +235 -0
- parsek_cdp/generate.py +642 -0
- parsek_cdp/parsek/__init__.py +18 -0
- parsek_cdp/parsek/events.py +38 -0
- parsek_cdp/parsek/types.py +36 -0
- parsek_cdp/py.typed +0 -0
- parsek_cdp-0.1.0.dist-info/METADATA +277 -0
- parsek_cdp-0.1.0.dist-info/RECORD +242 -0
- parsek_cdp-0.1.0.dist-info/WHEEL +5 -0
- parsek_cdp-0.1.0.dist-info/licenses/LICENSE +201 -0
- parsek_cdp-0.1.0.dist-info/top_level.txt +1 -0
parsek_cdp/__init__.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""parsek_cdp -- a Chrome DevTools Protocol client.
|
|
2
|
+
|
|
3
|
+
``cdp`` is the generated protocol layer (one module per domain); ``core`` is the
|
|
4
|
+
hand-written runtime (connection, browser, page, request tracking).
|
|
5
|
+
|
|
6
|
+
Quickstart::
|
|
7
|
+
|
|
8
|
+
import asyncio
|
|
9
|
+
from parsek_cdp import Browser, Page, RequestListener
|
|
10
|
+
|
|
11
|
+
async def main():
|
|
12
|
+
browser = await Browser.connect_http(
|
|
13
|
+
"http://127.0.0.1:9222", page_class=Page[RequestListener]
|
|
14
|
+
)
|
|
15
|
+
page = await browser.new_page("https://example.com")
|
|
16
|
+
await page.navigate("https://example.com", wait_load=True)
|
|
17
|
+
print(len(page.request_listener.requests), "requests captured")
|
|
18
|
+
|
|
19
|
+
asyncio.run(main())
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import logging
|
|
23
|
+
|
|
24
|
+
from ._logging import TRACE, get_logger
|
|
25
|
+
from .core import (
|
|
26
|
+
Browser,
|
|
27
|
+
BrowserContext,
|
|
28
|
+
Element,
|
|
29
|
+
Feature,
|
|
30
|
+
Page,
|
|
31
|
+
ProtocolError,
|
|
32
|
+
Target,
|
|
33
|
+
)
|
|
34
|
+
from .core.frame import ElementState, Frame, LoadState
|
|
35
|
+
from .core.page import NavigationError
|
|
36
|
+
from .features import RequestListener
|
|
37
|
+
|
|
38
|
+
# Library best practice: stay silent unless the application configures logging.
|
|
39
|
+
get_logger(__name__).addHandler(logging.NullHandler())
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"TRACE",
|
|
43
|
+
"Browser",
|
|
44
|
+
"BrowserContext",
|
|
45
|
+
"Element",
|
|
46
|
+
"ElementState",
|
|
47
|
+
"Feature",
|
|
48
|
+
"Frame",
|
|
49
|
+
"LoadState",
|
|
50
|
+
"NavigationError",
|
|
51
|
+
"Page",
|
|
52
|
+
"ProtocolError",
|
|
53
|
+
"RequestListener",
|
|
54
|
+
"Target",
|
|
55
|
+
]
|
parsek_cdp/_logging.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Logging helpers for parsek_cdp.
|
|
2
|
+
|
|
3
|
+
Adds a ``TRACE`` level (below ``DEBUG``) for the very verbose wire-level dumps
|
|
4
|
+
(every CDP frame sent/received) so they can be enabled independently of normal
|
|
5
|
+
debug logging. Use :func:`get_logger` per module::
|
|
6
|
+
|
|
7
|
+
from .._logging import get_logger
|
|
8
|
+
|
|
9
|
+
logger = get_logger(__name__)
|
|
10
|
+
logger.trace("send %s", payload) # only emitted when TRACE is enabled
|
|
11
|
+
|
|
12
|
+
The library never configures handlers itself (a ``NullHandler`` is attached to
|
|
13
|
+
the package logger in ``__init__``); the application decides where logs go, e.g.
|
|
14
|
+
``logging.basicConfig(level=parsek_cdp.TRACE)``.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import logging
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
#: Numeric level for wire-level tracing, below ``logging.DEBUG`` (10).
|
|
23
|
+
TRACE = 5
|
|
24
|
+
logging.addLevelName(TRACE, "TRACE")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TraceLogger(logging.Logger):
|
|
28
|
+
"""A :class:`logging.Logger` with an extra :meth:`trace` method."""
|
|
29
|
+
|
|
30
|
+
def trace(self, msg: object, *args: Any, **kwargs: Any) -> None:
|
|
31
|
+
"""Log at :data:`TRACE` level (cheap no-op when not enabled)."""
|
|
32
|
+
if self.isEnabledFor(TRACE):
|
|
33
|
+
self._log(TRACE, msg, args, **kwargs)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Loggers obtained from now on are TraceLogger instances.
|
|
37
|
+
logging.setLoggerClass(TraceLogger)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def get_logger(name: str) -> TraceLogger:
|
|
41
|
+
"""Return the module logger, typed so ``logger.trace`` is visible."""
|
|
42
|
+
return logging.getLogger(name) # type: ignore[return-value]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# The websockets library logs every frame at DEBUG, which drowns out our own
|
|
46
|
+
# logs once the app sets a DEBUG/TRACE root level. Cap it at WARNING by
|
|
47
|
+
# default; re-enable explicitly with
|
|
48
|
+
# ``logging.getLogger("websockets").setLevel(logging.DEBUG)``.
|
|
49
|
+
logging.getLogger("websockets").setLevel(logging.WARNING)
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"""Generated CDP package: every protocol domain.
|
|
2
|
+
|
|
3
|
+
Each domain is importable as a namespace::
|
|
4
|
+
|
|
5
|
+
from parsek_cdp.cdp import Network
|
|
6
|
+
Network.RequestWillBeSent # an event class
|
|
7
|
+
Network.ResourceType # a type / enum
|
|
8
|
+
await page.cdp.Network.enable() # a command (target-bound)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
from . import accessibility as Accessibility
|
|
16
|
+
from . import animation as Animation
|
|
17
|
+
from . import audits as Audits
|
|
18
|
+
from . import autofill as Autofill
|
|
19
|
+
from . import backgroundservice as BackgroundService
|
|
20
|
+
from . import bluetoothemulation as BluetoothEmulation
|
|
21
|
+
from . import browser as Browser
|
|
22
|
+
from . import cachestorage as CacheStorage
|
|
23
|
+
from . import cast as Cast
|
|
24
|
+
|
|
25
|
+
# Domain namespaces (events + types + command class).
|
|
26
|
+
from . import console as Console
|
|
27
|
+
from . import css as CSS
|
|
28
|
+
from . import debugger as Debugger
|
|
29
|
+
from . import deviceaccess as DeviceAccess
|
|
30
|
+
from . import deviceorientation as DeviceOrientation
|
|
31
|
+
from . import dom as DOM
|
|
32
|
+
from . import domdebugger as DOMDebugger
|
|
33
|
+
from . import domsnapshot as DOMSnapshot
|
|
34
|
+
from . import domstorage as DOMStorage
|
|
35
|
+
from . import emulation as Emulation
|
|
36
|
+
from . import eventbreakpoints as EventBreakpoints
|
|
37
|
+
from . import extensions as Extensions
|
|
38
|
+
from . import fedcm as FedCm
|
|
39
|
+
from . import fetch as Fetch
|
|
40
|
+
from . import filesystem as FileSystem
|
|
41
|
+
from . import headlessexperimental as HeadlessExperimental
|
|
42
|
+
from . import heapprofiler as HeapProfiler
|
|
43
|
+
from . import indexeddb as IndexedDB
|
|
44
|
+
from . import input as Input
|
|
45
|
+
from . import inspector as Inspector
|
|
46
|
+
from . import io as IO
|
|
47
|
+
from . import layertree as LayerTree
|
|
48
|
+
from . import log as Log
|
|
49
|
+
from . import media as Media
|
|
50
|
+
from . import memory as Memory
|
|
51
|
+
from . import network as Network
|
|
52
|
+
from . import overlay as Overlay
|
|
53
|
+
from . import page as Page
|
|
54
|
+
from . import performance as Performance
|
|
55
|
+
from . import performancetimeline as PerformanceTimeline
|
|
56
|
+
from . import preload as Preload
|
|
57
|
+
from . import profiler as Profiler
|
|
58
|
+
from . import pwa as PWA
|
|
59
|
+
from . import runtime as Runtime
|
|
60
|
+
from . import schema as Schema
|
|
61
|
+
from . import security as Security
|
|
62
|
+
from . import serviceworker as ServiceWorker
|
|
63
|
+
from . import storage as Storage
|
|
64
|
+
from . import systeminfo as SystemInfo
|
|
65
|
+
from . import target as Target
|
|
66
|
+
from . import tethering as Tethering
|
|
67
|
+
from . import tracing as Tracing
|
|
68
|
+
from . import webaudio as WebAudio
|
|
69
|
+
from . import webauthn as WebAuthn
|
|
70
|
+
from .accessibility.functions import Accessibility as _Accessibility
|
|
71
|
+
from .animation.functions import Animation as _Animation
|
|
72
|
+
from .audits.functions import Audits as _Audits
|
|
73
|
+
from .autofill.functions import Autofill as _Autofill
|
|
74
|
+
from .backgroundservice.functions import BackgroundService as _BackgroundService
|
|
75
|
+
from .bluetoothemulation.functions import BluetoothEmulation as _BluetoothEmulation
|
|
76
|
+
from .browser.functions import Browser as _Browser
|
|
77
|
+
from .cachestorage.functions import CacheStorage as _CacheStorage
|
|
78
|
+
from .cast.functions import Cast as _Cast
|
|
79
|
+
|
|
80
|
+
# Command classes for the per-target aggregator below.
|
|
81
|
+
from .console.functions import Console as _Console
|
|
82
|
+
from .css.functions import CSS as _CSS
|
|
83
|
+
from .debugger.functions import Debugger as _Debugger
|
|
84
|
+
from .deviceaccess.functions import DeviceAccess as _DeviceAccess
|
|
85
|
+
from .deviceorientation.functions import DeviceOrientation as _DeviceOrientation
|
|
86
|
+
from .dom.functions import DOM as _DOM
|
|
87
|
+
from .domdebugger.functions import DOMDebugger as _DOMDebugger
|
|
88
|
+
from .domsnapshot.functions import DOMSnapshot as _DOMSnapshot
|
|
89
|
+
from .domstorage.functions import DOMStorage as _DOMStorage
|
|
90
|
+
from .emulation.functions import Emulation as _Emulation
|
|
91
|
+
from .eventbreakpoints.functions import EventBreakpoints as _EventBreakpoints
|
|
92
|
+
from .extensions.functions import Extensions as _Extensions
|
|
93
|
+
from .fedcm.functions import FedCm as _FedCm
|
|
94
|
+
from .fetch.functions import Fetch as _Fetch
|
|
95
|
+
from .filesystem.functions import FileSystem as _FileSystem
|
|
96
|
+
from .headlessexperimental.functions import (
|
|
97
|
+
HeadlessExperimental as _HeadlessExperimental,
|
|
98
|
+
)
|
|
99
|
+
from .heapprofiler.functions import HeapProfiler as _HeapProfiler
|
|
100
|
+
from .indexeddb.functions import IndexedDB as _IndexedDB
|
|
101
|
+
from .input.functions import Input as _Input
|
|
102
|
+
from .inspector.functions import Inspector as _Inspector
|
|
103
|
+
from .io.functions import IO as _IO
|
|
104
|
+
from .layertree.functions import LayerTree as _LayerTree
|
|
105
|
+
from .log.functions import Log as _Log
|
|
106
|
+
from .media.functions import Media as _Media
|
|
107
|
+
from .memory.functions import Memory as _Memory
|
|
108
|
+
from .network.functions import Network as _Network
|
|
109
|
+
from .overlay.functions import Overlay as _Overlay
|
|
110
|
+
from .page.functions import Page as _Page
|
|
111
|
+
from .performance.functions import Performance as _Performance
|
|
112
|
+
from .performancetimeline.functions import PerformanceTimeline as _PerformanceTimeline
|
|
113
|
+
from .preload.functions import Preload as _Preload
|
|
114
|
+
from .profiler.functions import Profiler as _Profiler
|
|
115
|
+
from .pwa.functions import PWA as _PWA
|
|
116
|
+
from .runtime.functions import Runtime as _Runtime
|
|
117
|
+
from .schema.functions import Schema as _Schema
|
|
118
|
+
from .security.functions import Security as _Security
|
|
119
|
+
from .serviceworker.functions import ServiceWorker as _ServiceWorker
|
|
120
|
+
from .storage.functions import Storage as _Storage
|
|
121
|
+
from .systeminfo.functions import SystemInfo as _SystemInfo
|
|
122
|
+
from .target.functions import Target as _Target
|
|
123
|
+
from .tethering.functions import Tethering as _Tethering
|
|
124
|
+
from .tracing.functions import Tracing as _Tracing
|
|
125
|
+
from .webaudio.functions import WebAudio as _WebAudio
|
|
126
|
+
from .webauthn.functions import WebAuthn as _WebAuthn
|
|
127
|
+
|
|
128
|
+
if TYPE_CHECKING:
|
|
129
|
+
from ..core.target import CDPConnection
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class CDP:
|
|
133
|
+
"""Access every CDP domain through a single target (commands)."""
|
|
134
|
+
|
|
135
|
+
def __init__(self, target: "CDPConnection") -> None:
|
|
136
|
+
self.connection = target
|
|
137
|
+
self.Console = _Console(target)
|
|
138
|
+
self.Debugger = _Debugger(target)
|
|
139
|
+
self.HeapProfiler = _HeapProfiler(target)
|
|
140
|
+
self.Profiler = _Profiler(target)
|
|
141
|
+
self.Runtime = _Runtime(target)
|
|
142
|
+
self.Schema = _Schema(target)
|
|
143
|
+
self.Accessibility = _Accessibility(target)
|
|
144
|
+
self.Animation = _Animation(target)
|
|
145
|
+
self.Audits = _Audits(target)
|
|
146
|
+
self.Autofill = _Autofill(target)
|
|
147
|
+
self.BackgroundService = _BackgroundService(target)
|
|
148
|
+
self.BluetoothEmulation = _BluetoothEmulation(target)
|
|
149
|
+
self.Browser = _Browser(target)
|
|
150
|
+
self.CSS = _CSS(target)
|
|
151
|
+
self.CacheStorage = _CacheStorage(target)
|
|
152
|
+
self.Cast = _Cast(target)
|
|
153
|
+
self.DOM = _DOM(target)
|
|
154
|
+
self.DOMDebugger = _DOMDebugger(target)
|
|
155
|
+
self.DOMSnapshot = _DOMSnapshot(target)
|
|
156
|
+
self.DOMStorage = _DOMStorage(target)
|
|
157
|
+
self.DeviceAccess = _DeviceAccess(target)
|
|
158
|
+
self.DeviceOrientation = _DeviceOrientation(target)
|
|
159
|
+
self.Emulation = _Emulation(target)
|
|
160
|
+
self.EventBreakpoints = _EventBreakpoints(target)
|
|
161
|
+
self.Extensions = _Extensions(target)
|
|
162
|
+
self.FedCm = _FedCm(target)
|
|
163
|
+
self.Fetch = _Fetch(target)
|
|
164
|
+
self.FileSystem = _FileSystem(target)
|
|
165
|
+
self.HeadlessExperimental = _HeadlessExperimental(target)
|
|
166
|
+
self.IO = _IO(target)
|
|
167
|
+
self.IndexedDB = _IndexedDB(target)
|
|
168
|
+
self.Input = _Input(target)
|
|
169
|
+
self.Inspector = _Inspector(target)
|
|
170
|
+
self.LayerTree = _LayerTree(target)
|
|
171
|
+
self.Log = _Log(target)
|
|
172
|
+
self.Media = _Media(target)
|
|
173
|
+
self.Memory = _Memory(target)
|
|
174
|
+
self.Network = _Network(target)
|
|
175
|
+
self.Overlay = _Overlay(target)
|
|
176
|
+
self.PWA = _PWA(target)
|
|
177
|
+
self.Page = _Page(target)
|
|
178
|
+
self.Performance = _Performance(target)
|
|
179
|
+
self.PerformanceTimeline = _PerformanceTimeline(target)
|
|
180
|
+
self.Preload = _Preload(target)
|
|
181
|
+
self.Security = _Security(target)
|
|
182
|
+
self.ServiceWorker = _ServiceWorker(target)
|
|
183
|
+
self.Storage = _Storage(target)
|
|
184
|
+
self.SystemInfo = _SystemInfo(target)
|
|
185
|
+
self.Target = _Target(target)
|
|
186
|
+
self.Tethering = _Tethering(target)
|
|
187
|
+
self.Tracing = _Tracing(target)
|
|
188
|
+
self.WebAudio = _WebAudio(target)
|
|
189
|
+
self.WebAuthn = _WebAuthn(target)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
__all__ = [
|
|
193
|
+
"CDP",
|
|
194
|
+
"Console",
|
|
195
|
+
"Debugger",
|
|
196
|
+
"HeapProfiler",
|
|
197
|
+
"Profiler",
|
|
198
|
+
"Runtime",
|
|
199
|
+
"Schema",
|
|
200
|
+
"Accessibility",
|
|
201
|
+
"Animation",
|
|
202
|
+
"Audits",
|
|
203
|
+
"Autofill",
|
|
204
|
+
"BackgroundService",
|
|
205
|
+
"BluetoothEmulation",
|
|
206
|
+
"Browser",
|
|
207
|
+
"CSS",
|
|
208
|
+
"CacheStorage",
|
|
209
|
+
"Cast",
|
|
210
|
+
"DOM",
|
|
211
|
+
"DOMDebugger",
|
|
212
|
+
"DOMSnapshot",
|
|
213
|
+
"DOMStorage",
|
|
214
|
+
"DeviceAccess",
|
|
215
|
+
"DeviceOrientation",
|
|
216
|
+
"Emulation",
|
|
217
|
+
"EventBreakpoints",
|
|
218
|
+
"Extensions",
|
|
219
|
+
"FedCm",
|
|
220
|
+
"Fetch",
|
|
221
|
+
"FileSystem",
|
|
222
|
+
"HeadlessExperimental",
|
|
223
|
+
"IO",
|
|
224
|
+
"IndexedDB",
|
|
225
|
+
"Input",
|
|
226
|
+
"Inspector",
|
|
227
|
+
"LayerTree",
|
|
228
|
+
"Log",
|
|
229
|
+
"Media",
|
|
230
|
+
"Memory",
|
|
231
|
+
"Network",
|
|
232
|
+
"Overlay",
|
|
233
|
+
"PWA",
|
|
234
|
+
"Page",
|
|
235
|
+
"Performance",
|
|
236
|
+
"PerformanceTimeline",
|
|
237
|
+
"Preload",
|
|
238
|
+
"Security",
|
|
239
|
+
"ServiceWorker",
|
|
240
|
+
"Storage",
|
|
241
|
+
"SystemInfo",
|
|
242
|
+
"Target",
|
|
243
|
+
"Tethering",
|
|
244
|
+
"Tracing",
|
|
245
|
+
"WebAudio",
|
|
246
|
+
"WebAuthn",
|
|
247
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""The Accessibility CDP domain (generated).
|
|
2
|
+
|
|
3
|
+
Importing ``Accessibility`` from ``parsek_cdp.cdp`` gives a namespace with this
|
|
4
|
+
domain's events and types as attributes (``Accessibility.SomeEvent`` /
|
|
5
|
+
``Accessibility.SomeType``); commands run on a target via ``page.cdp.Accessibility``.
|
|
6
|
+
"""
|
|
7
|
+
from . import events, functions, types
|
|
8
|
+
from .functions import Accessibility
|
|
9
|
+
from .events import * # noqa: F401,F403 -- expose events on the namespace
|
|
10
|
+
from .types import * # noqa: F401,F403 -- expose types on the namespace
|
|
11
|
+
|
|
12
|
+
#: Protocol domain name (used by features that declare ``domains=(Accessibility,)``).
|
|
13
|
+
DOMAIN = "Accessibility"
|
|
14
|
+
|
|
15
|
+
__all__ = ["events", "functions", "types", "Accessibility", "DOMAIN"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Events for the Accessibility domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import FieldMeta
|
|
8
|
+
from ..mixins.event import Event, register_event
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from .types import AXNode
|
|
12
|
+
|
|
13
|
+
@register_event("Accessibility.loadComplete")
|
|
14
|
+
@dataclass
|
|
15
|
+
class LoadComplete(Event):
|
|
16
|
+
"""
|
|
17
|
+
The loadComplete event mirrors the load complete event sent by the browser to assistive
|
|
18
|
+
technology when the web page has finished loading.
|
|
19
|
+
"""
|
|
20
|
+
root: AXNode
|
|
21
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
22
|
+
FieldMeta('root', 'root', False, 'object', ref='Accessibility.AXNode'),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@register_event("Accessibility.nodesUpdated")
|
|
27
|
+
@dataclass
|
|
28
|
+
class NodesUpdated(Event):
|
|
29
|
+
"""The nodesUpdated event is sent every time a previously requested node has changed the in tree."""
|
|
30
|
+
nodes: List[AXNode]
|
|
31
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
32
|
+
FieldMeta('nodes', 'nodes', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Accessibility.AXNode')),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
__all__ = ["LoadComplete", "NodesUpdated"]
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"""Commands for the Accessibility domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import DataType, FieldMeta, encode
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from .types import (
|
|
11
|
+
AXNode,
|
|
12
|
+
AXNodeId,
|
|
13
|
+
)
|
|
14
|
+
from ..dom.types import BackendNodeId as DOM_BackendNodeId
|
|
15
|
+
from ..dom.types import NodeId as DOM_NodeId
|
|
16
|
+
from ..page.types import FrameId as Page_FrameId
|
|
17
|
+
from ..runtime.types import RemoteObjectId as Runtime_RemoteObjectId
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class GetPartialAXTreeReturn(DataType):
|
|
21
|
+
"""Return value of :meth:`Accessibility.get_partial_ax_tree`."""
|
|
22
|
+
nodes: List[AXNode]
|
|
23
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
24
|
+
FieldMeta('nodes', 'nodes', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Accessibility.AXNode')),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass
|
|
29
|
+
class GetFullAXTreeReturn(DataType):
|
|
30
|
+
"""Return value of :meth:`Accessibility.get_full_ax_tree`."""
|
|
31
|
+
nodes: List[AXNode]
|
|
32
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
33
|
+
FieldMeta('nodes', 'nodes', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Accessibility.AXNode')),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass
|
|
38
|
+
class GetRootAXNodeReturn(DataType):
|
|
39
|
+
"""Return value of :meth:`Accessibility.get_root_ax_node`."""
|
|
40
|
+
node: AXNode
|
|
41
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
42
|
+
FieldMeta('node', 'node', False, 'object', ref='Accessibility.AXNode'),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass
|
|
47
|
+
class GetAXNodeAndAncestorsReturn(DataType):
|
|
48
|
+
"""Return value of :meth:`Accessibility.get_ax_node_and_ancestors`."""
|
|
49
|
+
nodes: List[AXNode]
|
|
50
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
51
|
+
FieldMeta('nodes', 'nodes', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Accessibility.AXNode')),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class GetChildAXNodesReturn(DataType):
|
|
57
|
+
"""Return value of :meth:`Accessibility.get_child_ax_nodes`."""
|
|
58
|
+
nodes: List[AXNode]
|
|
59
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
60
|
+
FieldMeta('nodes', 'nodes', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Accessibility.AXNode')),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass
|
|
65
|
+
class QueryAXTreeReturn(DataType):
|
|
66
|
+
"""Return value of :meth:`Accessibility.query_ax_tree`."""
|
|
67
|
+
nodes: List[AXNode]
|
|
68
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
69
|
+
FieldMeta('nodes', 'nodes', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Accessibility.AXNode')),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class Accessibility:
|
|
74
|
+
"""Commands of the Accessibility domain, bound to a target."""
|
|
75
|
+
|
|
76
|
+
def __init__(self, target: Any) -> None:
|
|
77
|
+
self._target = target
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
async def disable(self) -> None:
|
|
81
|
+
"""Disables the accessibility domain."""
|
|
82
|
+
_params: Dict[str, Any] = {}
|
|
83
|
+
_result = await self._target.send('Accessibility.disable', _params)
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
async def enable(self) -> None:
|
|
87
|
+
"""
|
|
88
|
+
Enables the accessibility domain which causes `AXNodeId`s to remain consistent between method calls.
|
|
89
|
+
This turns on accessibility for the page, which can impact performance until accessibility is disabled.
|
|
90
|
+
"""
|
|
91
|
+
_params: Dict[str, Any] = {}
|
|
92
|
+
_result = await self._target.send('Accessibility.enable', _params)
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
async def get_partial_ax_tree(self, *, node_id: Optional[DOM_NodeId] = None, backend_node_id: Optional[DOM_BackendNodeId] = None, object_id: Optional[Runtime_RemoteObjectId] = None, fetch_relatives: Optional[bool] = None) -> GetPartialAXTreeReturn:
|
|
96
|
+
"""
|
|
97
|
+
Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
|
|
98
|
+
:param node_id: Identifier of the node to get the partial accessibility tree for.
|
|
99
|
+
:param backend_node_id: Identifier of the backend node to get the partial accessibility tree for.
|
|
100
|
+
:param object_id: JavaScript object id of the node wrapper to get the partial accessibility tree for.
|
|
101
|
+
:param fetch_relatives: Whether to fetch this node's ancestors, siblings and children. Defaults to true.
|
|
102
|
+
"""
|
|
103
|
+
_params: Dict[str, Any] = {}
|
|
104
|
+
if node_id is not None:
|
|
105
|
+
_params['nodeId'] = encode(FieldMeta('', '', False, 'primitive'), node_id)
|
|
106
|
+
if backend_node_id is not None:
|
|
107
|
+
_params['backendNodeId'] = encode(FieldMeta('', '', False, 'primitive'), backend_node_id)
|
|
108
|
+
if object_id is not None:
|
|
109
|
+
_params['objectId'] = encode(FieldMeta('', '', False, 'primitive'), object_id)
|
|
110
|
+
if fetch_relatives is not None:
|
|
111
|
+
_params['fetchRelatives'] = encode(FieldMeta('', '', False, 'primitive'), fetch_relatives)
|
|
112
|
+
_result = await self._target.send('Accessibility.getPartialAXTree', _params)
|
|
113
|
+
return GetPartialAXTreeReturn.from_json(_result)
|
|
114
|
+
|
|
115
|
+
async def get_full_ax_tree(self, *, depth: Optional[int] = None, frame_id: Optional[Page_FrameId] = None) -> GetFullAXTreeReturn:
|
|
116
|
+
"""
|
|
117
|
+
Fetches the entire accessibility tree for the root Document
|
|
118
|
+
:param depth: The maximum depth at which descendants of the root node should be retrieved.
|
|
119
|
+
If omitted, the full tree is returned.
|
|
120
|
+
:param frame_id: The frame for whose document the AX tree should be retrieved.
|
|
121
|
+
If omitted, the root frame is used.
|
|
122
|
+
"""
|
|
123
|
+
_params: Dict[str, Any] = {}
|
|
124
|
+
if depth is not None:
|
|
125
|
+
_params['depth'] = encode(FieldMeta('', '', False, 'primitive'), depth)
|
|
126
|
+
if frame_id is not None:
|
|
127
|
+
_params['frameId'] = encode(FieldMeta('', '', False, 'primitive'), frame_id)
|
|
128
|
+
_result = await self._target.send('Accessibility.getFullAXTree', _params)
|
|
129
|
+
return GetFullAXTreeReturn.from_json(_result)
|
|
130
|
+
|
|
131
|
+
async def get_root_ax_node(self, *, frame_id: Optional[Page_FrameId] = None) -> GetRootAXNodeReturn:
|
|
132
|
+
"""
|
|
133
|
+
Fetches the root node.
|
|
134
|
+
Requires `enable()` to have been called previously.
|
|
135
|
+
:param frame_id: The frame in whose document the node resides.
|
|
136
|
+
If omitted, the root frame is used.
|
|
137
|
+
"""
|
|
138
|
+
_params: Dict[str, Any] = {}
|
|
139
|
+
if frame_id is not None:
|
|
140
|
+
_params['frameId'] = encode(FieldMeta('', '', False, 'primitive'), frame_id)
|
|
141
|
+
_result = await self._target.send('Accessibility.getRootAXNode', _params)
|
|
142
|
+
return GetRootAXNodeReturn.from_json(_result)
|
|
143
|
+
|
|
144
|
+
async def get_ax_node_and_ancestors(self, *, node_id: Optional[DOM_NodeId] = None, backend_node_id: Optional[DOM_BackendNodeId] = None, object_id: Optional[Runtime_RemoteObjectId] = None) -> GetAXNodeAndAncestorsReturn:
|
|
145
|
+
"""
|
|
146
|
+
Fetches a node and all ancestors up to and including the root.
|
|
147
|
+
Requires `enable()` to have been called previously.
|
|
148
|
+
:param node_id: Identifier of the node to get.
|
|
149
|
+
:param backend_node_id: Identifier of the backend node to get.
|
|
150
|
+
:param object_id: JavaScript object id of the node wrapper to get.
|
|
151
|
+
"""
|
|
152
|
+
_params: Dict[str, Any] = {}
|
|
153
|
+
if node_id is not None:
|
|
154
|
+
_params['nodeId'] = encode(FieldMeta('', '', False, 'primitive'), node_id)
|
|
155
|
+
if backend_node_id is not None:
|
|
156
|
+
_params['backendNodeId'] = encode(FieldMeta('', '', False, 'primitive'), backend_node_id)
|
|
157
|
+
if object_id is not None:
|
|
158
|
+
_params['objectId'] = encode(FieldMeta('', '', False, 'primitive'), object_id)
|
|
159
|
+
_result = await self._target.send('Accessibility.getAXNodeAndAncestors', _params)
|
|
160
|
+
return GetAXNodeAndAncestorsReturn.from_json(_result)
|
|
161
|
+
|
|
162
|
+
async def get_child_ax_nodes(self, *, id: AXNodeId, frame_id: Optional[Page_FrameId] = None) -> GetChildAXNodesReturn:
|
|
163
|
+
"""
|
|
164
|
+
Fetches a particular accessibility node by AXNodeId.
|
|
165
|
+
Requires `enable()` to have been called previously.
|
|
166
|
+
:param id:
|
|
167
|
+
:param frame_id: The frame in whose document the node resides.
|
|
168
|
+
If omitted, the root frame is used.
|
|
169
|
+
"""
|
|
170
|
+
_params: Dict[str, Any] = {}
|
|
171
|
+
_params['id'] = encode(FieldMeta('', '', False, 'primitive'), id)
|
|
172
|
+
if frame_id is not None:
|
|
173
|
+
_params['frameId'] = encode(FieldMeta('', '', False, 'primitive'), frame_id)
|
|
174
|
+
_result = await self._target.send('Accessibility.getChildAXNodes', _params)
|
|
175
|
+
return GetChildAXNodesReturn.from_json(_result)
|
|
176
|
+
|
|
177
|
+
async def query_ax_tree(self, *, node_id: Optional[DOM_NodeId] = None, backend_node_id: Optional[DOM_BackendNodeId] = None, object_id: Optional[Runtime_RemoteObjectId] = None, accessible_name: Optional[str] = None, role: Optional[str] = None) -> QueryAXTreeReturn:
|
|
178
|
+
"""
|
|
179
|
+
Query a DOM node's accessibility subtree for accessible name and role.
|
|
180
|
+
This command computes the name and role for all nodes in the subtree, including those that are
|
|
181
|
+
ignored for accessibility, and returns those that match the specified name and role. If no DOM
|
|
182
|
+
node is specified, or the DOM node does not exist, the command returns an error. If neither
|
|
183
|
+
`accessibleName` or `role` is specified, it returns all the accessibility nodes in the subtree.
|
|
184
|
+
:param node_id: Identifier of the node for the root to query.
|
|
185
|
+
:param backend_node_id: Identifier of the backend node for the root to query.
|
|
186
|
+
:param object_id: JavaScript object id of the node wrapper for the root to query.
|
|
187
|
+
:param accessible_name: Find nodes with this computed name.
|
|
188
|
+
:param role: Find nodes with this computed role.
|
|
189
|
+
"""
|
|
190
|
+
_params: Dict[str, Any] = {}
|
|
191
|
+
if node_id is not None:
|
|
192
|
+
_params['nodeId'] = encode(FieldMeta('', '', False, 'primitive'), node_id)
|
|
193
|
+
if backend_node_id is not None:
|
|
194
|
+
_params['backendNodeId'] = encode(FieldMeta('', '', False, 'primitive'), backend_node_id)
|
|
195
|
+
if object_id is not None:
|
|
196
|
+
_params['objectId'] = encode(FieldMeta('', '', False, 'primitive'), object_id)
|
|
197
|
+
if accessible_name is not None:
|
|
198
|
+
_params['accessibleName'] = encode(FieldMeta('', '', False, 'primitive'), accessible_name)
|
|
199
|
+
if role is not None:
|
|
200
|
+
_params['role'] = encode(FieldMeta('', '', False, 'primitive'), role)
|
|
201
|
+
_result = await self._target.send('Accessibility.queryAXTree', _params)
|
|
202
|
+
return QueryAXTreeReturn.from_json(_result)
|