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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"""Commands for the PWA 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
|
+
DisplayMode,
|
|
12
|
+
FileHandler,
|
|
13
|
+
)
|
|
14
|
+
from ..target.types import TargetID as Target_TargetID
|
|
15
|
+
|
|
16
|
+
@dataclass
|
|
17
|
+
class GetOsAppStateReturn(DataType):
|
|
18
|
+
"""Return value of :meth:`PWA.get_os_app_state`."""
|
|
19
|
+
badge_count: int
|
|
20
|
+
file_handlers: List[FileHandler]
|
|
21
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
22
|
+
FieldMeta('badge_count', 'badgeCount', False, 'primitive'),
|
|
23
|
+
FieldMeta('file_handlers', 'fileHandlers', False, 'array', inner=FieldMeta('', '', False, 'object', ref='PWA.FileHandler')),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class LaunchReturn(DataType):
|
|
29
|
+
"""Return value of :meth:`PWA.launch`."""
|
|
30
|
+
target_id: Target_TargetID
|
|
31
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
32
|
+
FieldMeta('target_id', 'targetId', False, 'primitive'),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class LaunchFilesInAppReturn(DataType):
|
|
38
|
+
"""Return value of :meth:`PWA.launch_files_in_app`."""
|
|
39
|
+
target_ids: List[Target_TargetID]
|
|
40
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
41
|
+
FieldMeta('target_ids', 'targetIds', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class PWA:
|
|
46
|
+
"""Commands of the PWA domain, bound to a target."""
|
|
47
|
+
|
|
48
|
+
def __init__(self, target: Any) -> None:
|
|
49
|
+
self._target = target
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def get_os_app_state(self, *, manifest_id: str) -> GetOsAppStateReturn:
|
|
53
|
+
"""
|
|
54
|
+
Returns the following OS state for the given manifest id.
|
|
55
|
+
:param manifest_id: The id from the webapp's manifest file, commonly it's the url of the
|
|
56
|
+
site installing the webapp. See
|
|
57
|
+
https://web.dev/learn/pwa/web-app-manifest.
|
|
58
|
+
"""
|
|
59
|
+
_params: Dict[str, Any] = {}
|
|
60
|
+
_params['manifestId'] = encode(FieldMeta('', '', False, 'primitive'), manifest_id)
|
|
61
|
+
_result = await self._target.send('PWA.getOsAppState', _params)
|
|
62
|
+
return GetOsAppStateReturn.from_json(_result)
|
|
63
|
+
|
|
64
|
+
async def install(self, *, manifest_id: str, install_url_or_bundle_url: Optional[str] = None) -> None:
|
|
65
|
+
"""
|
|
66
|
+
Installs the given manifest identity, optionally using the given installUrlOrBundleUrl
|
|
67
|
+
|
|
68
|
+
IWA-specific install description:
|
|
69
|
+
manifestId corresponds to isolated-app:// + web_package::SignedWebBundleId
|
|
70
|
+
|
|
71
|
+
File installation mode:
|
|
72
|
+
The installUrlOrBundleUrl can be either file:// or http(s):// pointing
|
|
73
|
+
to a signed web bundle (.swbn). In this case SignedWebBundleId must correspond to
|
|
74
|
+
The .swbn file's signing key.
|
|
75
|
+
|
|
76
|
+
Dev proxy installation mode:
|
|
77
|
+
installUrlOrBundleUrl must be http(s):// that serves dev mode IWA.
|
|
78
|
+
web_package::SignedWebBundleId must be of type dev proxy.
|
|
79
|
+
|
|
80
|
+
The advantage of dev proxy mode is that all changes to IWA
|
|
81
|
+
automatically will be reflected in the running app without
|
|
82
|
+
reinstallation.
|
|
83
|
+
|
|
84
|
+
To generate bundle id for proxy mode:
|
|
85
|
+
1. Generate 32 random bytes.
|
|
86
|
+
2. Add a specific suffix at the end following the documentation
|
|
87
|
+
https://github.com/WICG/isolated-web-apps/blob/main/Scheme.md#suffix
|
|
88
|
+
3. Encode the entire sequence using Base32 without padding.
|
|
89
|
+
|
|
90
|
+
If Chrome is not in IWA dev
|
|
91
|
+
mode, the installation will fail, regardless of the state of the allowlist.
|
|
92
|
+
:param manifest_id:
|
|
93
|
+
:param install_url_or_bundle_url: The location of the app or bundle overriding the one derived from the
|
|
94
|
+
manifestId.
|
|
95
|
+
"""
|
|
96
|
+
_params: Dict[str, Any] = {}
|
|
97
|
+
_params['manifestId'] = encode(FieldMeta('', '', False, 'primitive'), manifest_id)
|
|
98
|
+
if install_url_or_bundle_url is not None:
|
|
99
|
+
_params['installUrlOrBundleUrl'] = encode(FieldMeta('', '', False, 'primitive'), install_url_or_bundle_url)
|
|
100
|
+
_result = await self._target.send('PWA.install', _params)
|
|
101
|
+
return None
|
|
102
|
+
|
|
103
|
+
async def uninstall(self, *, manifest_id: str) -> None:
|
|
104
|
+
"""
|
|
105
|
+
Uninstalls the given manifest_id and closes any opened app windows.
|
|
106
|
+
:param manifest_id:
|
|
107
|
+
"""
|
|
108
|
+
_params: Dict[str, Any] = {}
|
|
109
|
+
_params['manifestId'] = encode(FieldMeta('', '', False, 'primitive'), manifest_id)
|
|
110
|
+
_result = await self._target.send('PWA.uninstall', _params)
|
|
111
|
+
return None
|
|
112
|
+
|
|
113
|
+
async def launch(self, *, manifest_id: str, url: Optional[str] = None) -> LaunchReturn:
|
|
114
|
+
"""
|
|
115
|
+
Launches the installed web app, or an url in the same web app instead of the
|
|
116
|
+
default start url if it is provided. Returns a page Target.TargetID which
|
|
117
|
+
can be used to attach to via Target.attachToTarget or similar APIs.
|
|
118
|
+
:param manifest_id:
|
|
119
|
+
:param url:
|
|
120
|
+
"""
|
|
121
|
+
_params: Dict[str, Any] = {}
|
|
122
|
+
_params['manifestId'] = encode(FieldMeta('', '', False, 'primitive'), manifest_id)
|
|
123
|
+
if url is not None:
|
|
124
|
+
_params['url'] = encode(FieldMeta('', '', False, 'primitive'), url)
|
|
125
|
+
_result = await self._target.send('PWA.launch', _params)
|
|
126
|
+
return LaunchReturn.from_json(_result)
|
|
127
|
+
|
|
128
|
+
async def launch_files_in_app(self, *, manifest_id: str, files: List[str]) -> LaunchFilesInAppReturn:
|
|
129
|
+
"""
|
|
130
|
+
Opens one or more local files from an installed web app identified by its
|
|
131
|
+
manifestId. The web app needs to have file handlers registered to process
|
|
132
|
+
the files. The API returns one or more page Target.TargetIDs which can be
|
|
133
|
+
used to attach to via Target.attachToTarget or similar APIs.
|
|
134
|
+
If some files in the parameters cannot be handled by the web app, they will
|
|
135
|
+
be ignored. If none of the files can be handled, this API returns an error.
|
|
136
|
+
If no files are provided as the parameter, this API also returns an error.
|
|
137
|
+
|
|
138
|
+
According to the definition of the file handlers in the manifest file, one
|
|
139
|
+
Target.TargetID may represent a page handling one or more files. The order
|
|
140
|
+
of the returned Target.TargetIDs is not guaranteed.
|
|
141
|
+
|
|
142
|
+
TODO(crbug.com/339454034): Check the existences of the input files.
|
|
143
|
+
:param manifest_id:
|
|
144
|
+
:param files:
|
|
145
|
+
"""
|
|
146
|
+
_params: Dict[str, Any] = {}
|
|
147
|
+
_params['manifestId'] = encode(FieldMeta('', '', False, 'primitive'), manifest_id)
|
|
148
|
+
_params['files'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive')), files)
|
|
149
|
+
_result = await self._target.send('PWA.launchFilesInApp', _params)
|
|
150
|
+
return LaunchFilesInAppReturn.from_json(_result)
|
|
151
|
+
|
|
152
|
+
async def open_current_page_in_app(self, *, manifest_id: str) -> None:
|
|
153
|
+
"""
|
|
154
|
+
Opens the current page in its web app identified by the manifest id, needs
|
|
155
|
+
to be called on a page target. This function returns immediately without
|
|
156
|
+
waiting for the app to finish loading.
|
|
157
|
+
:param manifest_id:
|
|
158
|
+
"""
|
|
159
|
+
_params: Dict[str, Any] = {}
|
|
160
|
+
_params['manifestId'] = encode(FieldMeta('', '', False, 'primitive'), manifest_id)
|
|
161
|
+
_result = await self._target.send('PWA.openCurrentPageInApp', _params)
|
|
162
|
+
return None
|
|
163
|
+
|
|
164
|
+
async def change_app_user_settings(self, *, manifest_id: str, link_capturing: Optional[bool] = None, display_mode: Optional[DisplayMode] = None) -> None:
|
|
165
|
+
"""
|
|
166
|
+
Changes user settings of the web app identified by its manifestId. If the
|
|
167
|
+
app was not installed, this command returns an error. Unset parameters will
|
|
168
|
+
be ignored; unrecognized values will cause an error.
|
|
169
|
+
|
|
170
|
+
Unlike the ones defined in the manifest files of the web apps, these
|
|
171
|
+
settings are provided by the browser and controlled by the users, they
|
|
172
|
+
impact the way the browser handling the web apps.
|
|
173
|
+
|
|
174
|
+
See the comment of each parameter.
|
|
175
|
+
:param manifest_id:
|
|
176
|
+
:param link_capturing: If user allows the links clicked on by the user in the app's scope, or
|
|
177
|
+
extended scope if the manifest has scope extensions and the flags
|
|
178
|
+
`DesktopPWAsLinkCapturingWithScopeExtensions` and
|
|
179
|
+
`WebAppEnableScopeExtensions` are enabled.
|
|
180
|
+
|
|
181
|
+
Note, the API does not support resetting the linkCapturing to the
|
|
182
|
+
initial value, uninstalling and installing the web app again will reset
|
|
183
|
+
it.
|
|
184
|
+
|
|
185
|
+
TODO(crbug.com/339453269): Setting this value on ChromeOS is not
|
|
186
|
+
supported yet.
|
|
187
|
+
:param display_mode:
|
|
188
|
+
"""
|
|
189
|
+
_params: Dict[str, Any] = {}
|
|
190
|
+
_params['manifestId'] = encode(FieldMeta('', '', False, 'primitive'), manifest_id)
|
|
191
|
+
if link_capturing is not None:
|
|
192
|
+
_params['linkCapturing'] = encode(FieldMeta('', '', False, 'primitive'), link_capturing)
|
|
193
|
+
if display_mode is not None:
|
|
194
|
+
_params['displayMode'] = encode(FieldMeta('', '', False, 'enum', ref='PWA.DisplayMode'), display_mode)
|
|
195
|
+
_result = await self._target.send('PWA.changeAppUserSettings', _params)
|
|
196
|
+
return None
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Custom types and enums for the PWA domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional
|
|
7
|
+
|
|
8
|
+
from ..mixins.datatype import DataType, FieldMeta, register
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@register("PWA.FileHandlerAccept")
|
|
12
|
+
@dataclass
|
|
13
|
+
class FileHandlerAccept(DataType):
|
|
14
|
+
"""
|
|
15
|
+
The following types are the replica of
|
|
16
|
+
https://crsrc.org/c/chrome/browser/web_applications/proto/web_app_os_integration_state.proto;drc=9910d3be894c8f142c977ba1023f30a656bc13fc;l=67
|
|
17
|
+
"""
|
|
18
|
+
media_type: str
|
|
19
|
+
file_extensions: List[str]
|
|
20
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
21
|
+
FieldMeta('media_type', 'mediaType', False, 'primitive'),
|
|
22
|
+
FieldMeta('file_extensions', 'fileExtensions', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@register("PWA.FileHandler")
|
|
27
|
+
@dataclass
|
|
28
|
+
class FileHandler(DataType):
|
|
29
|
+
action: str
|
|
30
|
+
accepts: List[FileHandlerAccept]
|
|
31
|
+
display_name: str
|
|
32
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
33
|
+
FieldMeta('action', 'action', False, 'primitive'),
|
|
34
|
+
FieldMeta('accepts', 'accepts', False, 'array', inner=FieldMeta('', '', False, 'object', ref='PWA.FileHandlerAccept')),
|
|
35
|
+
FieldMeta('display_name', 'displayName', False, 'primitive'),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@register("PWA.DisplayMode")
|
|
40
|
+
class DisplayMode(str, Enum):
|
|
41
|
+
"""If user prefers opening the app in browser or an app window."""
|
|
42
|
+
STANDALONE = 'standalone'
|
|
43
|
+
BROWSER = 'browser'
|
|
44
|
+
|
|
45
|
+
__all__ = ["DisplayMode", "FileHandler", "FileHandlerAccept"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""The Runtime CDP domain (generated).
|
|
2
|
+
|
|
3
|
+
Importing ``Runtime`` from ``parsek_cdp.cdp`` gives a namespace with this
|
|
4
|
+
domain's events and types as attributes (``Runtime.SomeEvent`` /
|
|
5
|
+
``Runtime.SomeType``); commands run on a target via ``page.cdp.Runtime``.
|
|
6
|
+
"""
|
|
7
|
+
from . import events, functions, types
|
|
8
|
+
from .functions import Runtime
|
|
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=(Runtime,)``).
|
|
13
|
+
DOMAIN = "Runtime"
|
|
14
|
+
|
|
15
|
+
__all__ = ["events", "functions", "types", "Runtime", "DOMAIN"]
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""Events for the Runtime 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 (
|
|
12
|
+
ExceptionDetails,
|
|
13
|
+
ExecutionContextDescription,
|
|
14
|
+
ExecutionContextId,
|
|
15
|
+
RemoteObject,
|
|
16
|
+
StackTrace,
|
|
17
|
+
Timestamp,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
@register_event("Runtime.bindingCalled")
|
|
21
|
+
@dataclass
|
|
22
|
+
class BindingCalled(Event):
|
|
23
|
+
"""Notification is issued every time when binding is called."""
|
|
24
|
+
name: str
|
|
25
|
+
payload: str
|
|
26
|
+
execution_context_id: ExecutionContextId
|
|
27
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
28
|
+
FieldMeta('name', 'name', False, 'primitive'),
|
|
29
|
+
FieldMeta('payload', 'payload', False, 'primitive'),
|
|
30
|
+
FieldMeta('execution_context_id', 'executionContextId', False, 'primitive'),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@register_event("Runtime.consoleAPICalled")
|
|
35
|
+
@dataclass
|
|
36
|
+
class ConsoleAPICalled(Event):
|
|
37
|
+
"""Issued when console API was called."""
|
|
38
|
+
type_: Literal['log', 'debug', 'info', 'error', 'warning', 'dir', 'dirxml', 'table', 'trace', 'clear', 'startGroup', 'startGroupCollapsed', 'endGroup', 'assert', 'profile', 'profileEnd', 'count', 'timeEnd']
|
|
39
|
+
args: List[RemoteObject]
|
|
40
|
+
execution_context_id: ExecutionContextId
|
|
41
|
+
timestamp: Timestamp
|
|
42
|
+
stack_trace: Optional[StackTrace] = None
|
|
43
|
+
context: Optional[str] = None
|
|
44
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
45
|
+
FieldMeta('type_', 'type', False, 'primitive'),
|
|
46
|
+
FieldMeta('args', 'args', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Runtime.RemoteObject')),
|
|
47
|
+
FieldMeta('execution_context_id', 'executionContextId', False, 'primitive'),
|
|
48
|
+
FieldMeta('timestamp', 'timestamp', False, 'primitive'),
|
|
49
|
+
FieldMeta('stack_trace', 'stackTrace', True, 'object', ref='Runtime.StackTrace'),
|
|
50
|
+
FieldMeta('context', 'context', True, 'primitive'),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@register_event("Runtime.exceptionRevoked")
|
|
55
|
+
@dataclass
|
|
56
|
+
class ExceptionRevoked(Event):
|
|
57
|
+
"""Issued when unhandled exception was revoked."""
|
|
58
|
+
reason: str
|
|
59
|
+
exception_id: int
|
|
60
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
61
|
+
FieldMeta('reason', 'reason', False, 'primitive'),
|
|
62
|
+
FieldMeta('exception_id', 'exceptionId', False, 'primitive'),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@register_event("Runtime.exceptionThrown")
|
|
67
|
+
@dataclass
|
|
68
|
+
class ExceptionThrown(Event):
|
|
69
|
+
"""Issued when exception was thrown and unhandled."""
|
|
70
|
+
timestamp: Timestamp
|
|
71
|
+
exception_details: ExceptionDetails
|
|
72
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
73
|
+
FieldMeta('timestamp', 'timestamp', False, 'primitive'),
|
|
74
|
+
FieldMeta('exception_details', 'exceptionDetails', False, 'object', ref='Runtime.ExceptionDetails'),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@register_event("Runtime.executionContextCreated")
|
|
79
|
+
@dataclass
|
|
80
|
+
class ExecutionContextCreated(Event):
|
|
81
|
+
"""Issued when new execution context is created."""
|
|
82
|
+
context: ExecutionContextDescription
|
|
83
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
84
|
+
FieldMeta('context', 'context', False, 'object', ref='Runtime.ExecutionContextDescription'),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@register_event("Runtime.executionContextDestroyed")
|
|
89
|
+
@dataclass
|
|
90
|
+
class ExecutionContextDestroyed(Event):
|
|
91
|
+
"""Issued when execution context is destroyed."""
|
|
92
|
+
execution_context_id: ExecutionContextId
|
|
93
|
+
execution_context_unique_id: str
|
|
94
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
95
|
+
FieldMeta('execution_context_id', 'executionContextId', False, 'primitive'),
|
|
96
|
+
FieldMeta('execution_context_unique_id', 'executionContextUniqueId', False, 'primitive'),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@register_event("Runtime.executionContextsCleared")
|
|
101
|
+
@dataclass
|
|
102
|
+
class ExecutionContextsCleared(Event):
|
|
103
|
+
"""Issued when all executionContexts were cleared in browser"""
|
|
104
|
+
__FIELDS__: ClassVar[tuple] = ()
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@register_event("Runtime.inspectRequested")
|
|
108
|
+
@dataclass
|
|
109
|
+
class InspectRequested(Event):
|
|
110
|
+
"""
|
|
111
|
+
Issued when object should be inspected (for example, as a result of inspect() command line API
|
|
112
|
+
call).
|
|
113
|
+
"""
|
|
114
|
+
object: RemoteObject
|
|
115
|
+
hints: Dict[str, Any]
|
|
116
|
+
execution_context_id: Optional[ExecutionContextId] = None
|
|
117
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
118
|
+
FieldMeta('object', 'object', False, 'object', ref='Runtime.RemoteObject'),
|
|
119
|
+
FieldMeta('hints', 'hints', False, 'primitive'),
|
|
120
|
+
FieldMeta('execution_context_id', 'executionContextId', True, 'primitive'),
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
__all__ = ["BindingCalled", "ConsoleAPICalled", "ExceptionRevoked", "ExceptionThrown", "ExecutionContextCreated", "ExecutionContextDestroyed", "ExecutionContextsCleared", "InspectRequested"]
|