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,111 @@
|
|
|
1
|
+
"""Commands for the DOMSnapshot 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
|
+
ComputedStyle,
|
|
12
|
+
DOMNode,
|
|
13
|
+
DocumentSnapshot,
|
|
14
|
+
LayoutTreeNode,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class GetSnapshotReturn(DataType):
|
|
19
|
+
"""Return value of :meth:`DOMSnapshot.get_snapshot`."""
|
|
20
|
+
dom_nodes: List[DOMNode]
|
|
21
|
+
layout_tree_nodes: List[LayoutTreeNode]
|
|
22
|
+
computed_styles: List[ComputedStyle]
|
|
23
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
24
|
+
FieldMeta('dom_nodes', 'domNodes', False, 'array', inner=FieldMeta('', '', False, 'object', ref='DOMSnapshot.DOMNode')),
|
|
25
|
+
FieldMeta('layout_tree_nodes', 'layoutTreeNodes', False, 'array', inner=FieldMeta('', '', False, 'object', ref='DOMSnapshot.LayoutTreeNode')),
|
|
26
|
+
FieldMeta('computed_styles', 'computedStyles', False, 'array', inner=FieldMeta('', '', False, 'object', ref='DOMSnapshot.ComputedStyle')),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass
|
|
31
|
+
class CaptureSnapshotReturn(DataType):
|
|
32
|
+
"""Return value of :meth:`DOMSnapshot.capture_snapshot`."""
|
|
33
|
+
documents: List[DocumentSnapshot]
|
|
34
|
+
strings: List[str]
|
|
35
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
36
|
+
FieldMeta('documents', 'documents', False, 'array', inner=FieldMeta('', '', False, 'object', ref='DOMSnapshot.DocumentSnapshot')),
|
|
37
|
+
FieldMeta('strings', 'strings', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class DOMSnapshot:
|
|
42
|
+
"""Commands of the DOMSnapshot domain, bound to a target."""
|
|
43
|
+
|
|
44
|
+
def __init__(self, target: Any) -> None:
|
|
45
|
+
self._target = target
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
async def disable(self) -> None:
|
|
49
|
+
"""Disables DOM snapshot agent for the given page."""
|
|
50
|
+
_params: Dict[str, Any] = {}
|
|
51
|
+
_result = await self._target.send('DOMSnapshot.disable', _params)
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
async def enable(self) -> None:
|
|
55
|
+
"""Enables DOM snapshot agent for the given page."""
|
|
56
|
+
_params: Dict[str, Any] = {}
|
|
57
|
+
_result = await self._target.send('DOMSnapshot.enable', _params)
|
|
58
|
+
return None
|
|
59
|
+
|
|
60
|
+
async def get_snapshot(self, *, computed_style_whitelist: List[str], include_event_listeners: Optional[bool] = None, include_paint_order: Optional[bool] = None, include_user_agent_shadow_tree: Optional[bool] = None) -> GetSnapshotReturn:
|
|
61
|
+
"""
|
|
62
|
+
Returns a document snapshot, including the full DOM tree of the root node (including iframes,
|
|
63
|
+
template contents, and imported documents) in a flattened array, as well as layout and
|
|
64
|
+
white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
|
|
65
|
+
flattened.
|
|
66
|
+
|
|
67
|
+
.. deprecated::
|
|
68
|
+
:param computed_style_whitelist: Whitelist of computed styles to return.
|
|
69
|
+
:param include_event_listeners: Whether or not to retrieve details of DOM listeners (default false).
|
|
70
|
+
:param include_paint_order: Whether to determine and include the paint order index of LayoutTreeNodes (default false).
|
|
71
|
+
:param include_user_agent_shadow_tree: Whether to include UA shadow tree in the snapshot (default false).
|
|
72
|
+
"""
|
|
73
|
+
_params: Dict[str, Any] = {}
|
|
74
|
+
_params['computedStyleWhitelist'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive')), computed_style_whitelist)
|
|
75
|
+
if include_event_listeners is not None:
|
|
76
|
+
_params['includeEventListeners'] = encode(FieldMeta('', '', False, 'primitive'), include_event_listeners)
|
|
77
|
+
if include_paint_order is not None:
|
|
78
|
+
_params['includePaintOrder'] = encode(FieldMeta('', '', False, 'primitive'), include_paint_order)
|
|
79
|
+
if include_user_agent_shadow_tree is not None:
|
|
80
|
+
_params['includeUserAgentShadowTree'] = encode(FieldMeta('', '', False, 'primitive'), include_user_agent_shadow_tree)
|
|
81
|
+
_result = await self._target.send('DOMSnapshot.getSnapshot', _params)
|
|
82
|
+
return GetSnapshotReturn.from_json(_result)
|
|
83
|
+
|
|
84
|
+
async def capture_snapshot(self, *, computed_styles: List[str], include_paint_order: Optional[bool] = None, include_dom_rects: Optional[bool] = None, include_blended_background_colors: Optional[bool] = None, include_text_color_opacities: Optional[bool] = None) -> CaptureSnapshotReturn:
|
|
85
|
+
"""
|
|
86
|
+
Returns a document snapshot, including the full DOM tree of the root node (including iframes,
|
|
87
|
+
template contents, and imported documents) in a flattened array, as well as layout and
|
|
88
|
+
white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
|
|
89
|
+
flattened.
|
|
90
|
+
:param computed_styles: Whitelist of computed styles to return.
|
|
91
|
+
:param include_paint_order: Whether to include layout object paint orders into the snapshot.
|
|
92
|
+
:param include_dom_rects: Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot
|
|
93
|
+
:param include_blended_background_colors: Whether to include blended background colors in the snapshot (default: false).
|
|
94
|
+
Blended background color is achieved by blending background colors of all elements
|
|
95
|
+
that overlap with the current element.
|
|
96
|
+
:param include_text_color_opacities: Whether to include text color opacity in the snapshot (default: false).
|
|
97
|
+
An element might have the opacity property set that affects the text color of the element.
|
|
98
|
+
The final text color opacity is computed based on the opacity of all overlapping elements.
|
|
99
|
+
"""
|
|
100
|
+
_params: Dict[str, Any] = {}
|
|
101
|
+
_params['computedStyles'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive')), computed_styles)
|
|
102
|
+
if include_paint_order is not None:
|
|
103
|
+
_params['includePaintOrder'] = encode(FieldMeta('', '', False, 'primitive'), include_paint_order)
|
|
104
|
+
if include_dom_rects is not None:
|
|
105
|
+
_params['includeDOMRects'] = encode(FieldMeta('', '', False, 'primitive'), include_dom_rects)
|
|
106
|
+
if include_blended_background_colors is not None:
|
|
107
|
+
_params['includeBlendedBackgroundColors'] = encode(FieldMeta('', '', False, 'primitive'), include_blended_background_colors)
|
|
108
|
+
if include_text_color_opacities is not None:
|
|
109
|
+
_params['includeTextColorOpacities'] = encode(FieldMeta('', '', False, 'primitive'), include_text_color_opacities)
|
|
110
|
+
_result = await self._target.send('DOMSnapshot.captureSnapshot', _params)
|
|
111
|
+
return CaptureSnapshotReturn.from_json(_result)
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"""Custom types and enums for the DOMSnapshot domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
7
|
+
|
|
8
|
+
from ..mixins.datatype import DataType, FieldMeta, register
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from ..dom.types import BackendNodeId as DOM_BackendNodeId
|
|
12
|
+
from ..dom.types import PseudoType as DOM_PseudoType
|
|
13
|
+
from ..dom.types import Rect as DOM_Rect
|
|
14
|
+
from ..dom.types import ShadowRootType as DOM_ShadowRootType
|
|
15
|
+
from ..domdebugger.types import EventListener as DOMDebugger_EventListener
|
|
16
|
+
from ..page.types import FrameId as Page_FrameId
|
|
17
|
+
|
|
18
|
+
@register("DOMSnapshot.DOMNode")
|
|
19
|
+
@dataclass
|
|
20
|
+
class DOMNode(DataType):
|
|
21
|
+
"""A Node in the DOM tree."""
|
|
22
|
+
node_type: int
|
|
23
|
+
node_name: str
|
|
24
|
+
node_value: str
|
|
25
|
+
backend_node_id: DOM_BackendNodeId
|
|
26
|
+
text_value: Optional[str] = None
|
|
27
|
+
input_value: Optional[str] = None
|
|
28
|
+
input_checked: Optional[bool] = None
|
|
29
|
+
option_selected: Optional[bool] = None
|
|
30
|
+
child_node_indexes: Optional[List[int]] = None
|
|
31
|
+
attributes: Optional[List[NameValue]] = None
|
|
32
|
+
pseudo_element_indexes: Optional[List[int]] = None
|
|
33
|
+
layout_node_index: Optional[int] = None
|
|
34
|
+
document_url: Optional[str] = None
|
|
35
|
+
base_url: Optional[str] = None
|
|
36
|
+
content_language: Optional[str] = None
|
|
37
|
+
document_encoding: Optional[str] = None
|
|
38
|
+
public_id: Optional[str] = None
|
|
39
|
+
system_id: Optional[str] = None
|
|
40
|
+
frame_id: Optional[Page_FrameId] = None
|
|
41
|
+
content_document_index: Optional[int] = None
|
|
42
|
+
pseudo_type: Optional[DOM_PseudoType] = None
|
|
43
|
+
shadow_root_type: Optional[DOM_ShadowRootType] = None
|
|
44
|
+
is_clickable: Optional[bool] = None
|
|
45
|
+
event_listeners: Optional[List[DOMDebugger_EventListener]] = None
|
|
46
|
+
current_source_url: Optional[str] = None
|
|
47
|
+
origin_url: Optional[str] = None
|
|
48
|
+
scroll_offset_x: Optional[float] = None
|
|
49
|
+
scroll_offset_y: Optional[float] = None
|
|
50
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
51
|
+
FieldMeta('node_type', 'nodeType', False, 'primitive'),
|
|
52
|
+
FieldMeta('node_name', 'nodeName', False, 'primitive'),
|
|
53
|
+
FieldMeta('node_value', 'nodeValue', False, 'primitive'),
|
|
54
|
+
FieldMeta('backend_node_id', 'backendNodeId', False, 'primitive'),
|
|
55
|
+
FieldMeta('text_value', 'textValue', True, 'primitive'),
|
|
56
|
+
FieldMeta('input_value', 'inputValue', True, 'primitive'),
|
|
57
|
+
FieldMeta('input_checked', 'inputChecked', True, 'primitive'),
|
|
58
|
+
FieldMeta('option_selected', 'optionSelected', True, 'primitive'),
|
|
59
|
+
FieldMeta('child_node_indexes', 'childNodeIndexes', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
60
|
+
FieldMeta('attributes', 'attributes', True, 'array', inner=FieldMeta('', '', False, 'object', ref='DOMSnapshot.NameValue')),
|
|
61
|
+
FieldMeta('pseudo_element_indexes', 'pseudoElementIndexes', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
62
|
+
FieldMeta('layout_node_index', 'layoutNodeIndex', True, 'primitive'),
|
|
63
|
+
FieldMeta('document_url', 'documentURL', True, 'primitive'),
|
|
64
|
+
FieldMeta('base_url', 'baseURL', True, 'primitive'),
|
|
65
|
+
FieldMeta('content_language', 'contentLanguage', True, 'primitive'),
|
|
66
|
+
FieldMeta('document_encoding', 'documentEncoding', True, 'primitive'),
|
|
67
|
+
FieldMeta('public_id', 'publicId', True, 'primitive'),
|
|
68
|
+
FieldMeta('system_id', 'systemId', True, 'primitive'),
|
|
69
|
+
FieldMeta('frame_id', 'frameId', True, 'primitive'),
|
|
70
|
+
FieldMeta('content_document_index', 'contentDocumentIndex', True, 'primitive'),
|
|
71
|
+
FieldMeta('pseudo_type', 'pseudoType', True, 'enum', ref='DOM.PseudoType'),
|
|
72
|
+
FieldMeta('shadow_root_type', 'shadowRootType', True, 'enum', ref='DOM.ShadowRootType'),
|
|
73
|
+
FieldMeta('is_clickable', 'isClickable', True, 'primitive'),
|
|
74
|
+
FieldMeta('event_listeners', 'eventListeners', True, 'array', inner=FieldMeta('', '', False, 'object', ref='DOMDebugger.EventListener')),
|
|
75
|
+
FieldMeta('current_source_url', 'currentSourceURL', True, 'primitive'),
|
|
76
|
+
FieldMeta('origin_url', 'originURL', True, 'primitive'),
|
|
77
|
+
FieldMeta('scroll_offset_x', 'scrollOffsetX', True, 'primitive'),
|
|
78
|
+
FieldMeta('scroll_offset_y', 'scrollOffsetY', True, 'primitive'),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@register("DOMSnapshot.InlineTextBox")
|
|
83
|
+
@dataclass
|
|
84
|
+
class InlineTextBox(DataType):
|
|
85
|
+
"""
|
|
86
|
+
Details of post layout rendered text positions. The exact layout should not be regarded as
|
|
87
|
+
stable and may change between versions.
|
|
88
|
+
"""
|
|
89
|
+
bounding_box: DOM_Rect
|
|
90
|
+
start_character_index: int
|
|
91
|
+
num_characters: int
|
|
92
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
93
|
+
FieldMeta('bounding_box', 'boundingBox', False, 'object', ref='DOM.Rect'),
|
|
94
|
+
FieldMeta('start_character_index', 'startCharacterIndex', False, 'primitive'),
|
|
95
|
+
FieldMeta('num_characters', 'numCharacters', False, 'primitive'),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@register("DOMSnapshot.LayoutTreeNode")
|
|
100
|
+
@dataclass
|
|
101
|
+
class LayoutTreeNode(DataType):
|
|
102
|
+
"""Details of an element in the DOM tree with a LayoutObject."""
|
|
103
|
+
dom_node_index: int
|
|
104
|
+
bounding_box: DOM_Rect
|
|
105
|
+
layout_text: Optional[str] = None
|
|
106
|
+
inline_text_nodes: Optional[List[InlineTextBox]] = None
|
|
107
|
+
style_index: Optional[int] = None
|
|
108
|
+
paint_order: Optional[int] = None
|
|
109
|
+
is_stacking_context: Optional[bool] = None
|
|
110
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
111
|
+
FieldMeta('dom_node_index', 'domNodeIndex', False, 'primitive'),
|
|
112
|
+
FieldMeta('bounding_box', 'boundingBox', False, 'object', ref='DOM.Rect'),
|
|
113
|
+
FieldMeta('layout_text', 'layoutText', True, 'primitive'),
|
|
114
|
+
FieldMeta('inline_text_nodes', 'inlineTextNodes', True, 'array', inner=FieldMeta('', '', False, 'object', ref='DOMSnapshot.InlineTextBox')),
|
|
115
|
+
FieldMeta('style_index', 'styleIndex', True, 'primitive'),
|
|
116
|
+
FieldMeta('paint_order', 'paintOrder', True, 'primitive'),
|
|
117
|
+
FieldMeta('is_stacking_context', 'isStackingContext', True, 'primitive'),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@register("DOMSnapshot.ComputedStyle")
|
|
122
|
+
@dataclass
|
|
123
|
+
class ComputedStyle(DataType):
|
|
124
|
+
"""A subset of the full ComputedStyle as defined by the request whitelist."""
|
|
125
|
+
properties: List[NameValue]
|
|
126
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
127
|
+
FieldMeta('properties', 'properties', False, 'array', inner=FieldMeta('', '', False, 'object', ref='DOMSnapshot.NameValue')),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@register("DOMSnapshot.NameValue")
|
|
132
|
+
@dataclass
|
|
133
|
+
class NameValue(DataType):
|
|
134
|
+
"""A name/value pair."""
|
|
135
|
+
name: str
|
|
136
|
+
value: str
|
|
137
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
138
|
+
FieldMeta('name', 'name', False, 'primitive'),
|
|
139
|
+
FieldMeta('value', 'value', False, 'primitive'),
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
type StringIndex = int # Index of the string in the strings table.
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
type ArrayOfStrings = List[StringIndex] # Index of the string in the strings table.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@register("DOMSnapshot.RareStringData")
|
|
150
|
+
@dataclass
|
|
151
|
+
class RareStringData(DataType):
|
|
152
|
+
"""Data that is only present on rare nodes."""
|
|
153
|
+
index: List[int]
|
|
154
|
+
value: List[StringIndex]
|
|
155
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
156
|
+
FieldMeta('index', 'index', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
157
|
+
FieldMeta('value', 'value', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
@register("DOMSnapshot.RareBooleanData")
|
|
162
|
+
@dataclass
|
|
163
|
+
class RareBooleanData(DataType):
|
|
164
|
+
index: List[int]
|
|
165
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
166
|
+
FieldMeta('index', 'index', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@register("DOMSnapshot.RareIntegerData")
|
|
171
|
+
@dataclass
|
|
172
|
+
class RareIntegerData(DataType):
|
|
173
|
+
index: List[int]
|
|
174
|
+
value: List[int]
|
|
175
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
176
|
+
FieldMeta('index', 'index', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
177
|
+
FieldMeta('value', 'value', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
type Rectangle = List[float]
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
@register("DOMSnapshot.DocumentSnapshot")
|
|
185
|
+
@dataclass
|
|
186
|
+
class DocumentSnapshot(DataType):
|
|
187
|
+
"""Document snapshot."""
|
|
188
|
+
document_url: StringIndex
|
|
189
|
+
title: StringIndex
|
|
190
|
+
base_url: StringIndex
|
|
191
|
+
content_language: StringIndex
|
|
192
|
+
encoding_name: StringIndex
|
|
193
|
+
public_id: StringIndex
|
|
194
|
+
system_id: StringIndex
|
|
195
|
+
frame_id: StringIndex
|
|
196
|
+
nodes: NodeTreeSnapshot
|
|
197
|
+
layout: LayoutTreeSnapshot
|
|
198
|
+
text_boxes: TextBoxSnapshot
|
|
199
|
+
scroll_offset_x: Optional[float] = None
|
|
200
|
+
scroll_offset_y: Optional[float] = None
|
|
201
|
+
content_width: Optional[float] = None
|
|
202
|
+
content_height: Optional[float] = None
|
|
203
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
204
|
+
FieldMeta('document_url', 'documentURL', False, 'primitive'),
|
|
205
|
+
FieldMeta('title', 'title', False, 'primitive'),
|
|
206
|
+
FieldMeta('base_url', 'baseURL', False, 'primitive'),
|
|
207
|
+
FieldMeta('content_language', 'contentLanguage', False, 'primitive'),
|
|
208
|
+
FieldMeta('encoding_name', 'encodingName', False, 'primitive'),
|
|
209
|
+
FieldMeta('public_id', 'publicId', False, 'primitive'),
|
|
210
|
+
FieldMeta('system_id', 'systemId', False, 'primitive'),
|
|
211
|
+
FieldMeta('frame_id', 'frameId', False, 'primitive'),
|
|
212
|
+
FieldMeta('nodes', 'nodes', False, 'object', ref='DOMSnapshot.NodeTreeSnapshot'),
|
|
213
|
+
FieldMeta('layout', 'layout', False, 'object', ref='DOMSnapshot.LayoutTreeSnapshot'),
|
|
214
|
+
FieldMeta('text_boxes', 'textBoxes', False, 'object', ref='DOMSnapshot.TextBoxSnapshot'),
|
|
215
|
+
FieldMeta('scroll_offset_x', 'scrollOffsetX', True, 'primitive'),
|
|
216
|
+
FieldMeta('scroll_offset_y', 'scrollOffsetY', True, 'primitive'),
|
|
217
|
+
FieldMeta('content_width', 'contentWidth', True, 'primitive'),
|
|
218
|
+
FieldMeta('content_height', 'contentHeight', True, 'primitive'),
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@register("DOMSnapshot.NodeTreeSnapshot")
|
|
223
|
+
@dataclass
|
|
224
|
+
class NodeTreeSnapshot(DataType):
|
|
225
|
+
"""Table containing nodes."""
|
|
226
|
+
parent_index: Optional[List[int]] = None
|
|
227
|
+
node_type: Optional[List[int]] = None
|
|
228
|
+
shadow_root_type: Optional[RareStringData] = None
|
|
229
|
+
node_name: Optional[List[StringIndex]] = None
|
|
230
|
+
node_value: Optional[List[StringIndex]] = None
|
|
231
|
+
backend_node_id: Optional[List[DOM_BackendNodeId]] = None
|
|
232
|
+
attributes: Optional[List[ArrayOfStrings]] = None
|
|
233
|
+
text_value: Optional[RareStringData] = None
|
|
234
|
+
input_value: Optional[RareStringData] = None
|
|
235
|
+
input_checked: Optional[RareBooleanData] = None
|
|
236
|
+
option_selected: Optional[RareBooleanData] = None
|
|
237
|
+
content_document_index: Optional[RareIntegerData] = None
|
|
238
|
+
pseudo_type: Optional[RareStringData] = None
|
|
239
|
+
pseudo_identifier: Optional[RareStringData] = None
|
|
240
|
+
is_clickable: Optional[RareBooleanData] = None
|
|
241
|
+
current_source_url: Optional[RareStringData] = None
|
|
242
|
+
origin_url: Optional[RareStringData] = None
|
|
243
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
244
|
+
FieldMeta('parent_index', 'parentIndex', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
245
|
+
FieldMeta('node_type', 'nodeType', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
246
|
+
FieldMeta('shadow_root_type', 'shadowRootType', True, 'object', ref='DOMSnapshot.RareStringData'),
|
|
247
|
+
FieldMeta('node_name', 'nodeName', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
248
|
+
FieldMeta('node_value', 'nodeValue', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
249
|
+
FieldMeta('backend_node_id', 'backendNodeId', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
250
|
+
FieldMeta('attributes', 'attributes', True, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
|
|
251
|
+
FieldMeta('text_value', 'textValue', True, 'object', ref='DOMSnapshot.RareStringData'),
|
|
252
|
+
FieldMeta('input_value', 'inputValue', True, 'object', ref='DOMSnapshot.RareStringData'),
|
|
253
|
+
FieldMeta('input_checked', 'inputChecked', True, 'object', ref='DOMSnapshot.RareBooleanData'),
|
|
254
|
+
FieldMeta('option_selected', 'optionSelected', True, 'object', ref='DOMSnapshot.RareBooleanData'),
|
|
255
|
+
FieldMeta('content_document_index', 'contentDocumentIndex', True, 'object', ref='DOMSnapshot.RareIntegerData'),
|
|
256
|
+
FieldMeta('pseudo_type', 'pseudoType', True, 'object', ref='DOMSnapshot.RareStringData'),
|
|
257
|
+
FieldMeta('pseudo_identifier', 'pseudoIdentifier', True, 'object', ref='DOMSnapshot.RareStringData'),
|
|
258
|
+
FieldMeta('is_clickable', 'isClickable', True, 'object', ref='DOMSnapshot.RareBooleanData'),
|
|
259
|
+
FieldMeta('current_source_url', 'currentSourceURL', True, 'object', ref='DOMSnapshot.RareStringData'),
|
|
260
|
+
FieldMeta('origin_url', 'originURL', True, 'object', ref='DOMSnapshot.RareStringData'),
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
@register("DOMSnapshot.LayoutTreeSnapshot")
|
|
265
|
+
@dataclass
|
|
266
|
+
class LayoutTreeSnapshot(DataType):
|
|
267
|
+
"""Table of details of an element in the DOM tree with a LayoutObject."""
|
|
268
|
+
node_index: List[int]
|
|
269
|
+
styles: List[ArrayOfStrings]
|
|
270
|
+
bounds: List[Rectangle]
|
|
271
|
+
text: List[StringIndex]
|
|
272
|
+
stacking_contexts: RareBooleanData
|
|
273
|
+
paint_orders: Optional[List[int]] = None
|
|
274
|
+
offset_rects: Optional[List[Rectangle]] = None
|
|
275
|
+
scroll_rects: Optional[List[Rectangle]] = None
|
|
276
|
+
client_rects: Optional[List[Rectangle]] = None
|
|
277
|
+
blended_background_colors: Optional[List[StringIndex]] = None
|
|
278
|
+
text_color_opacities: Optional[List[float]] = None
|
|
279
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
280
|
+
FieldMeta('node_index', 'nodeIndex', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
281
|
+
FieldMeta('styles', 'styles', False, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
|
|
282
|
+
FieldMeta('bounds', 'bounds', False, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
|
|
283
|
+
FieldMeta('text', 'text', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
284
|
+
FieldMeta('stacking_contexts', 'stackingContexts', False, 'object', ref='DOMSnapshot.RareBooleanData'),
|
|
285
|
+
FieldMeta('paint_orders', 'paintOrders', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
286
|
+
FieldMeta('offset_rects', 'offsetRects', True, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
|
|
287
|
+
FieldMeta('scroll_rects', 'scrollRects', True, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
|
|
288
|
+
FieldMeta('client_rects', 'clientRects', True, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
|
|
289
|
+
FieldMeta('blended_background_colors', 'blendedBackgroundColors', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
290
|
+
FieldMeta('text_color_opacities', 'textColorOpacities', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
@register("DOMSnapshot.TextBoxSnapshot")
|
|
295
|
+
@dataclass
|
|
296
|
+
class TextBoxSnapshot(DataType):
|
|
297
|
+
"""
|
|
298
|
+
Table of details of the post layout rendered text positions. The exact layout should not be regarded as
|
|
299
|
+
stable and may change between versions.
|
|
300
|
+
"""
|
|
301
|
+
layout_index: List[int]
|
|
302
|
+
bounds: List[Rectangle]
|
|
303
|
+
start: List[int]
|
|
304
|
+
length: List[int]
|
|
305
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
306
|
+
FieldMeta('layout_index', 'layoutIndex', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
307
|
+
FieldMeta('bounds', 'bounds', False, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
|
|
308
|
+
FieldMeta('start', 'start', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
309
|
+
FieldMeta('length', 'length', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
__all__ = ["ArrayOfStrings", "ComputedStyle", "DOMNode", "DocumentSnapshot", "InlineTextBox", "LayoutTreeNode", "LayoutTreeSnapshot", "NameValue", "NodeTreeSnapshot", "RareBooleanData", "RareIntegerData", "RareStringData", "Rectangle", "StringIndex", "TextBoxSnapshot"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""The DOMStorage CDP domain (generated).
|
|
2
|
+
|
|
3
|
+
Importing ``DOMStorage`` from ``parsek_cdp.cdp`` gives a namespace with this
|
|
4
|
+
domain's events and types as attributes (``DOMStorage.SomeEvent`` /
|
|
5
|
+
``DOMStorage.SomeType``); commands run on a target via ``page.cdp.DOMStorage``.
|
|
6
|
+
"""
|
|
7
|
+
from . import events, functions, types
|
|
8
|
+
from .functions import DOMStorage
|
|
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=(DOMStorage,)``).
|
|
13
|
+
DOMAIN = "DOMStorage"
|
|
14
|
+
|
|
15
|
+
__all__ = ["events", "functions", "types", "DOMStorage", "DOMAIN"]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Events for the DOMStorage 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 StorageId
|
|
12
|
+
|
|
13
|
+
@register_event("DOMStorage.domStorageItemAdded")
|
|
14
|
+
@dataclass
|
|
15
|
+
class DomStorageItemAdded(Event):
|
|
16
|
+
storage_id: StorageId
|
|
17
|
+
key: str
|
|
18
|
+
new_value: str
|
|
19
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
20
|
+
FieldMeta('storage_id', 'storageId', False, 'object', ref='DOMStorage.StorageId'),
|
|
21
|
+
FieldMeta('key', 'key', False, 'primitive'),
|
|
22
|
+
FieldMeta('new_value', 'newValue', False, 'primitive'),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@register_event("DOMStorage.domStorageItemRemoved")
|
|
27
|
+
@dataclass
|
|
28
|
+
class DomStorageItemRemoved(Event):
|
|
29
|
+
storage_id: StorageId
|
|
30
|
+
key: str
|
|
31
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
32
|
+
FieldMeta('storage_id', 'storageId', False, 'object', ref='DOMStorage.StorageId'),
|
|
33
|
+
FieldMeta('key', 'key', False, 'primitive'),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@register_event("DOMStorage.domStorageItemUpdated")
|
|
38
|
+
@dataclass
|
|
39
|
+
class DomStorageItemUpdated(Event):
|
|
40
|
+
storage_id: StorageId
|
|
41
|
+
key: str
|
|
42
|
+
old_value: str
|
|
43
|
+
new_value: str
|
|
44
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
45
|
+
FieldMeta('storage_id', 'storageId', False, 'object', ref='DOMStorage.StorageId'),
|
|
46
|
+
FieldMeta('key', 'key', False, 'primitive'),
|
|
47
|
+
FieldMeta('old_value', 'oldValue', False, 'primitive'),
|
|
48
|
+
FieldMeta('new_value', 'newValue', False, 'primitive'),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@register_event("DOMStorage.domStorageItemsCleared")
|
|
53
|
+
@dataclass
|
|
54
|
+
class DomStorageItemsCleared(Event):
|
|
55
|
+
storage_id: StorageId
|
|
56
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
57
|
+
FieldMeta('storage_id', 'storageId', False, 'object', ref='DOMStorage.StorageId'),
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
__all__ = ["DomStorageItemAdded", "DomStorageItemRemoved", "DomStorageItemUpdated", "DomStorageItemsCleared"]
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Commands for the DOMStorage 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
|
+
Item,
|
|
12
|
+
StorageId,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class GetDOMStorageItemsReturn(DataType):
|
|
17
|
+
"""Return value of :meth:`DOMStorage.get_dom_storage_items`."""
|
|
18
|
+
entries: List[Item]
|
|
19
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
20
|
+
FieldMeta('entries', 'entries', False, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class DOMStorage:
|
|
25
|
+
"""Commands of the DOMStorage domain, bound to a target."""
|
|
26
|
+
|
|
27
|
+
def __init__(self, target: Any) -> None:
|
|
28
|
+
self._target = target
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
async def clear(self, *, storage_id: StorageId) -> None:
|
|
32
|
+
""":param storage_id:"""
|
|
33
|
+
_params: Dict[str, Any] = {}
|
|
34
|
+
_params['storageId'] = encode(FieldMeta('', '', False, 'object', ref='DOMStorage.StorageId'), storage_id)
|
|
35
|
+
_result = await self._target.send('DOMStorage.clear', _params)
|
|
36
|
+
return None
|
|
37
|
+
|
|
38
|
+
async def disable(self) -> None:
|
|
39
|
+
"""Disables storage tracking, prevents storage events from being sent to the client."""
|
|
40
|
+
_params: Dict[str, Any] = {}
|
|
41
|
+
_result = await self._target.send('DOMStorage.disable', _params)
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
async def enable(self) -> None:
|
|
45
|
+
"""Enables storage tracking, storage events will now be delivered to the client."""
|
|
46
|
+
_params: Dict[str, Any] = {}
|
|
47
|
+
_result = await self._target.send('DOMStorage.enable', _params)
|
|
48
|
+
return None
|
|
49
|
+
|
|
50
|
+
async def get_dom_storage_items(self, *, storage_id: StorageId) -> GetDOMStorageItemsReturn:
|
|
51
|
+
""":param storage_id:"""
|
|
52
|
+
_params: Dict[str, Any] = {}
|
|
53
|
+
_params['storageId'] = encode(FieldMeta('', '', False, 'object', ref='DOMStorage.StorageId'), storage_id)
|
|
54
|
+
_result = await self._target.send('DOMStorage.getDOMStorageItems', _params)
|
|
55
|
+
return GetDOMStorageItemsReturn.from_json(_result)
|
|
56
|
+
|
|
57
|
+
async def remove_dom_storage_item(self, *, storage_id: StorageId, key: str) -> None:
|
|
58
|
+
"""
|
|
59
|
+
:param storage_id:
|
|
60
|
+
:param key:
|
|
61
|
+
"""
|
|
62
|
+
_params: Dict[str, Any] = {}
|
|
63
|
+
_params['storageId'] = encode(FieldMeta('', '', False, 'object', ref='DOMStorage.StorageId'), storage_id)
|
|
64
|
+
_params['key'] = encode(FieldMeta('', '', False, 'primitive'), key)
|
|
65
|
+
_result = await self._target.send('DOMStorage.removeDOMStorageItem', _params)
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
async def set_dom_storage_item(self, *, storage_id: StorageId, key: str, value: str) -> None:
|
|
69
|
+
"""
|
|
70
|
+
:param storage_id:
|
|
71
|
+
:param key:
|
|
72
|
+
:param value:
|
|
73
|
+
"""
|
|
74
|
+
_params: Dict[str, Any] = {}
|
|
75
|
+
_params['storageId'] = encode(FieldMeta('', '', False, 'object', ref='DOMStorage.StorageId'), storage_id)
|
|
76
|
+
_params['key'] = encode(FieldMeta('', '', False, 'primitive'), key)
|
|
77
|
+
_params['value'] = encode(FieldMeta('', '', False, 'primitive'), value)
|
|
78
|
+
_result = await self._target.send('DOMStorage.setDOMStorageItem', _params)
|
|
79
|
+
return None
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Custom types and enums for the DOMStorage 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
|
+
type SerializedStorageKey = str
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@register("DOMStorage.StorageId")
|
|
15
|
+
@dataclass
|
|
16
|
+
class StorageId(DataType):
|
|
17
|
+
"""DOM Storage identifier."""
|
|
18
|
+
is_local_storage: bool
|
|
19
|
+
security_origin: Optional[str] = None
|
|
20
|
+
storage_key: Optional[SerializedStorageKey] = None
|
|
21
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
22
|
+
FieldMeta('is_local_storage', 'isLocalStorage', False, 'primitive'),
|
|
23
|
+
FieldMeta('security_origin', 'securityOrigin', True, 'primitive'),
|
|
24
|
+
FieldMeta('storage_key', 'storageKey', True, 'primitive'),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
type Item = List[str] # DOM Storage item.
|
|
29
|
+
|
|
30
|
+
__all__ = ["Item", "SerializedStorageKey", "StorageId"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""The Emulation CDP domain (generated).
|
|
2
|
+
|
|
3
|
+
Importing ``Emulation`` from ``parsek_cdp.cdp`` gives a namespace with this
|
|
4
|
+
domain's events and types as attributes (``Emulation.SomeEvent`` /
|
|
5
|
+
``Emulation.SomeType``); commands run on a target via ``page.cdp.Emulation``.
|
|
6
|
+
"""
|
|
7
|
+
from . import events, functions, types
|
|
8
|
+
from .functions import Emulation
|
|
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=(Emulation,)``).
|
|
13
|
+
DOMAIN = "Emulation"
|
|
14
|
+
|
|
15
|
+
__all__ = ["events", "functions", "types", "Emulation", "DOMAIN"]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Events for the Emulation domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import FieldMeta
|
|
8
|
+
from ..mixins.event import Event, register_event
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@register_event("Emulation.virtualTimeBudgetExpired")
|
|
12
|
+
@dataclass
|
|
13
|
+
class VirtualTimeBudgetExpired(Event):
|
|
14
|
+
"""Notification sent after the virtual time budget for the current VirtualTimePolicy has run out."""
|
|
15
|
+
__FIELDS__: ClassVar[tuple] = ()
|
|
16
|
+
|
|
17
|
+
__all__ = ["VirtualTimeBudgetExpired"]
|