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.
Files changed (242) hide show
  1. parsek_cdp/__init__.py +55 -0
  2. parsek_cdp/_logging.py +49 -0
  3. parsek_cdp/cdp/__init__.py +247 -0
  4. parsek_cdp/cdp/accessibility/__init__.py +15 -0
  5. parsek_cdp/cdp/accessibility/events.py +35 -0
  6. parsek_cdp/cdp/accessibility/functions.py +202 -0
  7. parsek_cdp/cdp/accessibility/types.py +235 -0
  8. parsek_cdp/cdp/animation/__init__.py +15 -0
  9. parsek_cdp/cdp/animation/events.py +52 -0
  10. parsek_cdp/cdp/animation/functions.py +140 -0
  11. parsek_cdp/cdp/animation/types.py +113 -0
  12. parsek_cdp/cdp/audits/__init__.py +15 -0
  13. parsek_cdp/cdp/audits/events.py +21 -0
  14. parsek_cdp/cdp/audits/functions.py +95 -0
  15. parsek_cdp/cdp/audits/types.py +1051 -0
  16. parsek_cdp/cdp/autofill/__init__.py +15 -0
  17. parsek_cdp/cdp/autofill/events.py +27 -0
  18. parsek_cdp/cdp/autofill/functions.py +64 -0
  19. parsek_cdp/cdp/autofill/types.py +108 -0
  20. parsek_cdp/cdp/backgroundservice/__init__.py +15 -0
  21. parsek_cdp/cdp/backgroundservice/events.py +40 -0
  22. parsek_cdp/cdp/backgroundservice/functions.py +59 -0
  23. parsek_cdp/cdp/backgroundservice/types.py +63 -0
  24. parsek_cdp/cdp/bluetoothemulation/__init__.py +15 -0
  25. parsek_cdp/cdp/bluetoothemulation/events.py +70 -0
  26. parsek_cdp/cdp/bluetoothemulation/functions.py +247 -0
  27. parsek_cdp/cdp/bluetoothemulation/types.py +120 -0
  28. parsek_cdp/cdp/browser/__init__.py +15 -0
  29. parsek_cdp/cdp/browser/events.py +46 -0
  30. parsek_cdp/cdp/browser/functions.py +350 -0
  31. parsek_cdp/cdp/browser/types.py +158 -0
  32. parsek_cdp/cdp/cachestorage/__init__.py +15 -0
  33. parsek_cdp/cdp/cachestorage/events.py +13 -0
  34. parsek_cdp/cdp/cachestorage/functions.py +126 -0
  35. parsek_cdp/cdp/cachestorage/types.py +89 -0
  36. parsek_cdp/cdp/cast/__init__.py +15 -0
  37. parsek_cdp/cdp/cast/events.py +38 -0
  38. parsek_cdp/cdp/cast/functions.py +77 -0
  39. parsek_cdp/cdp/cast/types.py +23 -0
  40. parsek_cdp/cdp/console/__init__.py +15 -0
  41. parsek_cdp/cdp/console/events.py +22 -0
  42. parsek_cdp/cdp/console/functions.py +36 -0
  43. parsek_cdp/cdp/console/types.py +30 -0
  44. parsek_cdp/cdp/css/__init__.py +15 -0
  45. parsek_cdp/cdp/css/events.py +79 -0
  46. parsek_cdp/cdp/css/functions.py +788 -0
  47. parsek_cdp/cdp/css/types.py +742 -0
  48. parsek_cdp/cdp/debugger/__init__.py +15 -0
  49. parsek_cdp/cdp/debugger/events.py +164 -0
  50. parsek_cdp/cdp/debugger/functions.py +663 -0
  51. parsek_cdp/cdp/debugger/types.py +171 -0
  52. parsek_cdp/cdp/deviceaccess/__init__.py +15 -0
  53. parsek_cdp/cdp/deviceaccess/events.py +30 -0
  54. parsek_cdp/cdp/deviceaccess/functions.py +54 -0
  55. parsek_cdp/cdp/deviceaccess/types.py +28 -0
  56. parsek_cdp/cdp/deviceorientation/__init__.py +15 -0
  57. parsek_cdp/cdp/deviceorientation/events.py +13 -0
  58. parsek_cdp/cdp/deviceorientation/functions.py +35 -0
  59. parsek_cdp/cdp/deviceorientation/types.py +10 -0
  60. parsek_cdp/cdp/dom/__init__.py +15 -0
  61. parsek_cdp/cdp/dom/events.py +228 -0
  62. parsek_cdp/cdp/dom/functions.py +1033 -0
  63. parsek_cdp/cdp/dom/types.py +293 -0
  64. parsek_cdp/cdp/domdebugger/__init__.py +15 -0
  65. parsek_cdp/cdp/domdebugger/events.py +13 -0
  66. parsek_cdp/cdp/domdebugger/functions.py +155 -0
  67. parsek_cdp/cdp/domdebugger/types.py +57 -0
  68. parsek_cdp/cdp/domsnapshot/__init__.py +15 -0
  69. parsek_cdp/cdp/domsnapshot/events.py +13 -0
  70. parsek_cdp/cdp/domsnapshot/functions.py +111 -0
  71. parsek_cdp/cdp/domsnapshot/types.py +312 -0
  72. parsek_cdp/cdp/domstorage/__init__.py +15 -0
  73. parsek_cdp/cdp/domstorage/events.py +60 -0
  74. parsek_cdp/cdp/domstorage/functions.py +79 -0
  75. parsek_cdp/cdp/domstorage/types.py +30 -0
  76. parsek_cdp/cdp/emulation/__init__.py +15 -0
  77. parsek_cdp/cdp/emulation/events.py +17 -0
  78. parsek_cdp/cdp/emulation/functions.py +688 -0
  79. parsek_cdp/cdp/emulation/types.py +305 -0
  80. parsek_cdp/cdp/eventbreakpoints/__init__.py +15 -0
  81. parsek_cdp/cdp/eventbreakpoints/events.py +13 -0
  82. parsek_cdp/cdp/eventbreakpoints/functions.py +41 -0
  83. parsek_cdp/cdp/eventbreakpoints/types.py +10 -0
  84. parsek_cdp/cdp/extensions/__init__.py +15 -0
  85. parsek_cdp/cdp/extensions/events.py +13 -0
  86. parsek_cdp/cdp/extensions/functions.py +118 -0
  87. parsek_cdp/cdp/extensions/types.py +19 -0
  88. parsek_cdp/cdp/fedcm/__init__.py +15 -0
  89. parsek_cdp/cdp/fedcm/events.py +45 -0
  90. parsek_cdp/cdp/fedcm/functions.py +93 -0
  91. parsek_cdp/cdp/fedcm/types.py +72 -0
  92. parsek_cdp/cdp/fetch/__init__.py +15 -0
  93. parsek_cdp/cdp/fetch/events.py +82 -0
  94. parsek_cdp/cdp/fetch/functions.py +215 -0
  95. parsek_cdp/cdp/fetch/types.py +81 -0
  96. parsek_cdp/cdp/filesystem/__init__.py +15 -0
  97. parsek_cdp/cdp/filesystem/events.py +13 -0
  98. parsek_cdp/cdp/filesystem/functions.py +36 -0
  99. parsek_cdp/cdp/filesystem/types.py +54 -0
  100. parsek_cdp/cdp/headlessexperimental/__init__.py +15 -0
  101. parsek_cdp/cdp/headlessexperimental/events.py +13 -0
  102. parsek_cdp/cdp/headlessexperimental/functions.py +77 -0
  103. parsek_cdp/cdp/headlessexperimental/types.py +24 -0
  104. parsek_cdp/cdp/heapprofiler/__init__.py +15 -0
  105. parsek_cdp/cdp/heapprofiler/events.py +65 -0
  106. parsek_cdp/cdp/heapprofiler/functions.py +193 -0
  107. parsek_cdp/cdp/heapprofiler/types.py +57 -0
  108. parsek_cdp/cdp/indexeddb/__init__.py +15 -0
  109. parsek_cdp/cdp/indexeddb/events.py +13 -0
  110. parsek_cdp/cdp/indexeddb/functions.py +232 -0
  111. parsek_cdp/cdp/indexeddb/types.py +120 -0
  112. parsek_cdp/cdp/input/__init__.py +15 -0
  113. parsek_cdp/cdp/input/events.py +25 -0
  114. parsek_cdp/cdp/input/functions.py +361 -0
  115. parsek_cdp/cdp/input/types.py +87 -0
  116. parsek_cdp/cdp/inspector/__init__.py +15 -0
  117. parsek_cdp/cdp/inspector/events.py +41 -0
  118. parsek_cdp/cdp/inspector/functions.py +27 -0
  119. parsek_cdp/cdp/inspector/types.py +10 -0
  120. parsek_cdp/cdp/io/__init__.py +15 -0
  121. parsek_cdp/cdp/io/events.py +13 -0
  122. parsek_cdp/cdp/io/functions.py +77 -0
  123. parsek_cdp/cdp/io/types.py +13 -0
  124. parsek_cdp/cdp/layertree/__init__.py +15 -0
  125. parsek_cdp/cdp/layertree/events.py +36 -0
  126. parsek_cdp/cdp/layertree/functions.py +178 -0
  127. parsek_cdp/cdp/layertree/types.py +104 -0
  128. parsek_cdp/cdp/log/__init__.py +15 -0
  129. parsek_cdp/cdp/log/events.py +22 -0
  130. parsek_cdp/cdp/log/functions.py +54 -0
  131. parsek_cdp/cdp/log/types.py +57 -0
  132. parsek_cdp/cdp/media/__init__.py +15 -0
  133. parsek_cdp/cdp/media/events.py +87 -0
  134. parsek_cdp/cdp/media/functions.py +27 -0
  135. parsek_cdp/cdp/media/types.py +101 -0
  136. parsek_cdp/cdp/memory/__init__.py +15 -0
  137. parsek_cdp/cdp/memory/events.py +13 -0
  138. parsek_cdp/cdp/memory/functions.py +164 -0
  139. parsek_cdp/cdp/memory/types.py +71 -0
  140. parsek_cdp/cdp/mixins/__init__.py +21 -0
  141. parsek_cdp/cdp/mixins/datatype.py +123 -0
  142. parsek_cdp/cdp/mixins/event.py +78 -0
  143. parsek_cdp/cdp/mixins/namespace.py +31 -0
  144. parsek_cdp/cdp/network/__init__.py +15 -0
  145. parsek_cdp/cdp/network/events.py +726 -0
  146. parsek_cdp/cdp/network/functions.py +734 -0
  147. parsek_cdp/cdp/network/types.py +1247 -0
  148. parsek_cdp/cdp/overlay/__init__.py +15 -0
  149. parsek_cdp/cdp/overlay/events.py +54 -0
  150. parsek_cdp/cdp/overlay/functions.py +407 -0
  151. parsek_cdp/cdp/overlay/types.py +328 -0
  152. parsek_cdp/cdp/page/__init__.py +15 -0
  153. parsek_cdp/cdp/page/events.py +416 -0
  154. parsek_cdp/cdp/page/functions.py +1081 -0
  155. parsek_cdp/cdp/page/types.py +1088 -0
  156. parsek_cdp/cdp/performance/__init__.py +15 -0
  157. parsek_cdp/cdp/performance/events.py +24 -0
  158. parsek_cdp/cdp/performance/functions.py +63 -0
  159. parsek_cdp/cdp/performance/types.py +22 -0
  160. parsek_cdp/cdp/performancetimeline/__init__.py +15 -0
  161. parsek_cdp/cdp/performancetimeline/events.py +22 -0
  162. parsek_cdp/cdp/performancetimeline/functions.py +30 -0
  163. parsek_cdp/cdp/performancetimeline/types.py +85 -0
  164. parsek_cdp/cdp/preload/__init__.py +15 -0
  165. parsek_cdp/cdp/preload/events.py +116 -0
  166. parsek_cdp/cdp/preload/functions.py +25 -0
  167. parsek_cdp/cdp/preload/types.py +267 -0
  168. parsek_cdp/cdp/profiler/__init__.py +15 -0
  169. parsek_cdp/cdp/profiler/events.py +64 -0
  170. parsek_cdp/cdp/profiler/functions.py +134 -0
  171. parsek_cdp/cdp/profiler/types.py +105 -0
  172. parsek_cdp/cdp/pwa/__init__.py +15 -0
  173. parsek_cdp/cdp/pwa/events.py +13 -0
  174. parsek_cdp/cdp/pwa/functions.py +196 -0
  175. parsek_cdp/cdp/pwa/types.py +45 -0
  176. parsek_cdp/cdp/runtime/__init__.py +15 -0
  177. parsek_cdp/cdp/runtime/events.py +123 -0
  178. parsek_cdp/cdp/runtime/functions.py +552 -0
  179. parsek_cdp/cdp/runtime/types.py +319 -0
  180. parsek_cdp/cdp/schema/__init__.py +15 -0
  181. parsek_cdp/cdp/schema/events.py +13 -0
  182. parsek_cdp/cdp/schema/functions.py +32 -0
  183. parsek_cdp/cdp/schema/types.py +22 -0
  184. parsek_cdp/cdp/security/__init__.py +15 -0
  185. parsek_cdp/cdp/security/events.py +64 -0
  186. parsek_cdp/cdp/security/functions.py +66 -0
  187. parsek_cdp/cdp/security/types.py +168 -0
  188. parsek_cdp/cdp/serviceworker/__init__.py +15 -0
  189. parsek_cdp/cdp/serviceworker/events.py +43 -0
  190. parsek_cdp/cdp/serviceworker/functions.py +115 -0
  191. parsek_cdp/cdp/serviceworker/types.py +95 -0
  192. parsek_cdp/cdp/storage/__init__.py +15 -0
  193. parsek_cdp/cdp/storage/events.py +288 -0
  194. parsek_cdp/cdp/storage/functions.py +571 -0
  195. parsek_cdp/cdp/storage/types.py +656 -0
  196. parsek_cdp/cdp/systeminfo/__init__.py +15 -0
  197. parsek_cdp/cdp/systeminfo/events.py +13 -0
  198. parsek_cdp/cdp/systeminfo/functions.py +75 -0
  199. parsek_cdp/cdp/systeminfo/types.py +132 -0
  200. parsek_cdp/cdp/target/__init__.py +15 -0
  201. parsek_cdp/cdp/target/events.py +109 -0
  202. parsek_cdp/cdp/target/functions.py +424 -0
  203. parsek_cdp/cdp/target/types.py +83 -0
  204. parsek_cdp/cdp/tethering/__init__.py +15 -0
  205. parsek_cdp/cdp/tethering/events.py +22 -0
  206. parsek_cdp/cdp/tethering/functions.py +35 -0
  207. parsek_cdp/cdp/tethering/types.py +10 -0
  208. parsek_cdp/cdp/tracing/__init__.py +15 -0
  209. parsek_cdp/cdp/tracing/events.py +61 -0
  210. parsek_cdp/cdp/tracing/functions.py +119 -0
  211. parsek_cdp/cdp/tracing/types.py +81 -0
  212. parsek_cdp/cdp/webaudio/__init__.py +15 -0
  213. parsek_cdp/cdp/webaudio/events.py +184 -0
  214. parsek_cdp/cdp/webaudio/functions.py +51 -0
  215. parsek_cdp/cdp/webaudio/types.py +155 -0
  216. parsek_cdp/cdp/webauthn/__init__.py +15 -0
  217. parsek_cdp/cdp/webauthn/events.py +69 -0
  218. parsek_cdp/cdp/webauthn/functions.py +214 -0
  219. parsek_cdp/cdp/webauthn/types.py +96 -0
  220. parsek_cdp/core/__init__.py +18 -0
  221. parsek_cdp/core/browser.py +240 -0
  222. parsek_cdp/core/browser_context.py +58 -0
  223. parsek_cdp/core/element.py +405 -0
  224. parsek_cdp/core/feature.py +376 -0
  225. parsek_cdp/core/frame.py +351 -0
  226. parsek_cdp/core/pagable.py +175 -0
  227. parsek_cdp/core/page.py +163 -0
  228. parsek_cdp/core/target.py +490 -0
  229. parsek_cdp/features/__init__.py +14 -0
  230. parsek_cdp/features/request_listener/__init__.py +256 -0
  231. parsek_cdp/features/request_listener/events.py +48 -0
  232. parsek_cdp/features/request_listener/types.py +235 -0
  233. parsek_cdp/generate.py +642 -0
  234. parsek_cdp/parsek/__init__.py +18 -0
  235. parsek_cdp/parsek/events.py +38 -0
  236. parsek_cdp/parsek/types.py +36 -0
  237. parsek_cdp/py.typed +0 -0
  238. parsek_cdp-0.1.0.dist-info/METADATA +277 -0
  239. parsek_cdp-0.1.0.dist-info/RECORD +242 -0
  240. parsek_cdp-0.1.0.dist-info/WHEEL +5 -0
  241. parsek_cdp-0.1.0.dist-info/licenses/LICENSE +201 -0
  242. parsek_cdp-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,77 @@
1
+ """Commands for the IO 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 StreamHandle
11
+ from ..runtime.types import RemoteObjectId as Runtime_RemoteObjectId
12
+
13
+ @dataclass
14
+ class ReadReturn(DataType):
15
+ """Return value of :meth:`IO.read`."""
16
+ data: str
17
+ eof: bool
18
+ base64_encoded: Optional[bool] = None
19
+ __FIELDS__: ClassVar[tuple] = (
20
+ FieldMeta('data', 'data', False, 'primitive'),
21
+ FieldMeta('eof', 'eof', False, 'primitive'),
22
+ FieldMeta('base64_encoded', 'base64Encoded', True, 'primitive'),
23
+ )
24
+
25
+
26
+ @dataclass
27
+ class ResolveBlobReturn(DataType):
28
+ """Return value of :meth:`IO.resolve_blob`."""
29
+ uuid: str
30
+ __FIELDS__: ClassVar[tuple] = (
31
+ FieldMeta('uuid', 'uuid', False, 'primitive'),
32
+ )
33
+
34
+
35
+ class IO:
36
+ """Commands of the IO domain, bound to a target."""
37
+
38
+ def __init__(self, target: Any) -> None:
39
+ self._target = target
40
+
41
+
42
+ async def close(self, *, handle: StreamHandle) -> None:
43
+ """
44
+ Close the stream, discard any temporary backing storage.
45
+ :param handle: Handle of the stream to close.
46
+ """
47
+ _params: Dict[str, Any] = {}
48
+ _params['handle'] = encode(FieldMeta('', '', False, 'primitive'), handle)
49
+ _result = await self._target.send('IO.close', _params)
50
+ return None
51
+
52
+ async def read(self, *, handle: StreamHandle, offset: Optional[int] = None, size: Optional[int] = None) -> ReadReturn:
53
+ """
54
+ Read a chunk of the stream
55
+ :param handle: Handle of the stream to read.
56
+ :param offset: Seek to the specified offset before reading (if not specified, proceed with offset
57
+ following the last read). Some types of streams may only support sequential reads.
58
+ :param size: Maximum number of bytes to read (left upon the agent discretion if not specified).
59
+ """
60
+ _params: Dict[str, Any] = {}
61
+ _params['handle'] = encode(FieldMeta('', '', False, 'primitive'), handle)
62
+ if offset is not None:
63
+ _params['offset'] = encode(FieldMeta('', '', False, 'primitive'), offset)
64
+ if size is not None:
65
+ _params['size'] = encode(FieldMeta('', '', False, 'primitive'), size)
66
+ _result = await self._target.send('IO.read', _params)
67
+ return ReadReturn.from_json(_result)
68
+
69
+ async def resolve_blob(self, *, object_id: Runtime_RemoteObjectId) -> ResolveBlobReturn:
70
+ """
71
+ Return UUID of Blob object specified by a remote object id.
72
+ :param object_id: Object id of a Blob object wrapper.
73
+ """
74
+ _params: Dict[str, Any] = {}
75
+ _params['objectId'] = encode(FieldMeta('', '', False, 'primitive'), object_id)
76
+ _result = await self._target.send('IO.resolveBlob', _params)
77
+ return ResolveBlobReturn.from_json(_result)
@@ -0,0 +1,13 @@
1
+ """Custom types and enums for the IO 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 StreamHandle = str # This is either obtained from another method or specified as `blob:<uuid>` where
12
+
13
+ __all__ = ["StreamHandle"]
@@ -0,0 +1,15 @@
1
+ """The LayerTree CDP domain (generated).
2
+
3
+ Importing ``LayerTree`` from ``parsek_cdp.cdp`` gives a namespace with this
4
+ domain's events and types as attributes (``LayerTree.SomeEvent`` /
5
+ ``LayerTree.SomeType``); commands run on a target via ``page.cdp.LayerTree``.
6
+ """
7
+ from . import events, functions, types
8
+ from .functions import LayerTree
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=(LayerTree,)``).
13
+ DOMAIN = "LayerTree"
14
+
15
+ __all__ = ["events", "functions", "types", "LayerTree", "DOMAIN"]
@@ -0,0 +1,36 @@
1
+ """Events for the LayerTree 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
+ Layer,
13
+ LayerId,
14
+ )
15
+ from ..dom.types import Rect as DOM_Rect
16
+
17
+ @register_event("LayerTree.layerPainted")
18
+ @dataclass
19
+ class LayerPainted(Event):
20
+ layer_id: LayerId
21
+ clip: DOM_Rect
22
+ __FIELDS__: ClassVar[tuple] = (
23
+ FieldMeta('layer_id', 'layerId', False, 'primitive'),
24
+ FieldMeta('clip', 'clip', False, 'object', ref='DOM.Rect'),
25
+ )
26
+
27
+
28
+ @register_event("LayerTree.layerTreeDidChange")
29
+ @dataclass
30
+ class LayerTreeDidChange(Event):
31
+ layers: Optional[List[Layer]] = None
32
+ __FIELDS__: ClassVar[tuple] = (
33
+ FieldMeta('layers', 'layers', True, 'array', inner=FieldMeta('', '', False, 'object', ref='LayerTree.Layer')),
34
+ )
35
+
36
+ __all__ = ["LayerPainted", "LayerTreeDidChange"]
@@ -0,0 +1,178 @@
1
+ """Commands for the LayerTree 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
+ LayerId,
12
+ PaintProfile,
13
+ PictureTile,
14
+ SnapshotId,
15
+ )
16
+ from ..dom.types import Rect as DOM_Rect
17
+
18
+ @dataclass
19
+ class CompositingReasonsReturn(DataType):
20
+ """Return value of :meth:`LayerTree.compositing_reasons`."""
21
+ compositing_reasons: List[str]
22
+ compositing_reason_ids: List[str]
23
+ __FIELDS__: ClassVar[tuple] = (
24
+ FieldMeta('compositing_reasons', 'compositingReasons', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
25
+ FieldMeta('compositing_reason_ids', 'compositingReasonIds', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
26
+ )
27
+
28
+
29
+ @dataclass
30
+ class LoadSnapshotReturn(DataType):
31
+ """Return value of :meth:`LayerTree.load_snapshot`."""
32
+ snapshot_id: SnapshotId
33
+ __FIELDS__: ClassVar[tuple] = (
34
+ FieldMeta('snapshot_id', 'snapshotId', False, 'primitive'),
35
+ )
36
+
37
+
38
+ @dataclass
39
+ class MakeSnapshotReturn(DataType):
40
+ """Return value of :meth:`LayerTree.make_snapshot`."""
41
+ snapshot_id: SnapshotId
42
+ __FIELDS__: ClassVar[tuple] = (
43
+ FieldMeta('snapshot_id', 'snapshotId', False, 'primitive'),
44
+ )
45
+
46
+
47
+ @dataclass
48
+ class ProfileSnapshotReturn(DataType):
49
+ """Return value of :meth:`LayerTree.profile_snapshot`."""
50
+ timings: List[PaintProfile]
51
+ __FIELDS__: ClassVar[tuple] = (
52
+ FieldMeta('timings', 'timings', False, 'array', inner=FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive'))),
53
+ )
54
+
55
+
56
+ @dataclass
57
+ class ReplaySnapshotReturn(DataType):
58
+ """Return value of :meth:`LayerTree.replay_snapshot`."""
59
+ data_url: str
60
+ __FIELDS__: ClassVar[tuple] = (
61
+ FieldMeta('data_url', 'dataURL', False, 'primitive'),
62
+ )
63
+
64
+
65
+ @dataclass
66
+ class SnapshotCommandLogReturn(DataType):
67
+ """Return value of :meth:`LayerTree.snapshot_command_log`."""
68
+ command_log: List[Dict[str, Any]]
69
+ __FIELDS__: ClassVar[tuple] = (
70
+ FieldMeta('command_log', 'commandLog', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
71
+ )
72
+
73
+
74
+ class LayerTree:
75
+ """Commands of the LayerTree domain, bound to a target."""
76
+
77
+ def __init__(self, target: Any) -> None:
78
+ self._target = target
79
+
80
+
81
+ async def compositing_reasons(self, *, layer_id: LayerId) -> CompositingReasonsReturn:
82
+ """
83
+ Provides the reasons why the given layer was composited.
84
+ :param layer_id: The id of the layer for which we want to get the reasons it was composited.
85
+ """
86
+ _params: Dict[str, Any] = {}
87
+ _params['layerId'] = encode(FieldMeta('', '', False, 'primitive'), layer_id)
88
+ _result = await self._target.send('LayerTree.compositingReasons', _params)
89
+ return CompositingReasonsReturn.from_json(_result)
90
+
91
+ async def disable(self) -> None:
92
+ """Disables compositing tree inspection."""
93
+ _params: Dict[str, Any] = {}
94
+ _result = await self._target.send('LayerTree.disable', _params)
95
+ return None
96
+
97
+ async def enable(self) -> None:
98
+ """Enables compositing tree inspection."""
99
+ _params: Dict[str, Any] = {}
100
+ _result = await self._target.send('LayerTree.enable', _params)
101
+ return None
102
+
103
+ async def load_snapshot(self, *, tiles: List[PictureTile]) -> LoadSnapshotReturn:
104
+ """
105
+ Returns the snapshot identifier.
106
+ :param tiles: An array of tiles composing the snapshot.
107
+ """
108
+ _params: Dict[str, Any] = {}
109
+ _params['tiles'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='LayerTree.PictureTile')), tiles)
110
+ _result = await self._target.send('LayerTree.loadSnapshot', _params)
111
+ return LoadSnapshotReturn.from_json(_result)
112
+
113
+ async def make_snapshot(self, *, layer_id: LayerId) -> MakeSnapshotReturn:
114
+ """
115
+ Returns the layer snapshot identifier.
116
+ :param layer_id: The id of the layer.
117
+ """
118
+ _params: Dict[str, Any] = {}
119
+ _params['layerId'] = encode(FieldMeta('', '', False, 'primitive'), layer_id)
120
+ _result = await self._target.send('LayerTree.makeSnapshot', _params)
121
+ return MakeSnapshotReturn.from_json(_result)
122
+
123
+ async def profile_snapshot(self, *, snapshot_id: SnapshotId, min_repeat_count: Optional[int] = None, min_duration: Optional[float] = None, clip_rect: Optional[DOM_Rect] = None) -> ProfileSnapshotReturn:
124
+ """
125
+ :param snapshot_id: The id of the layer snapshot.
126
+ :param min_repeat_count: The maximum number of times to replay the snapshot (1, if not specified).
127
+ :param min_duration: The minimum duration (in seconds) to replay the snapshot.
128
+ :param clip_rect: The clip rectangle to apply when replaying the snapshot.
129
+ """
130
+ _params: Dict[str, Any] = {}
131
+ _params['snapshotId'] = encode(FieldMeta('', '', False, 'primitive'), snapshot_id)
132
+ if min_repeat_count is not None:
133
+ _params['minRepeatCount'] = encode(FieldMeta('', '', False, 'primitive'), min_repeat_count)
134
+ if min_duration is not None:
135
+ _params['minDuration'] = encode(FieldMeta('', '', False, 'primitive'), min_duration)
136
+ if clip_rect is not None:
137
+ _params['clipRect'] = encode(FieldMeta('', '', False, 'object', ref='DOM.Rect'), clip_rect)
138
+ _result = await self._target.send('LayerTree.profileSnapshot', _params)
139
+ return ProfileSnapshotReturn.from_json(_result)
140
+
141
+ async def release_snapshot(self, *, snapshot_id: SnapshotId) -> None:
142
+ """
143
+ Releases layer snapshot captured by the back-end.
144
+ :param snapshot_id: The id of the layer snapshot.
145
+ """
146
+ _params: Dict[str, Any] = {}
147
+ _params['snapshotId'] = encode(FieldMeta('', '', False, 'primitive'), snapshot_id)
148
+ _result = await self._target.send('LayerTree.releaseSnapshot', _params)
149
+ return None
150
+
151
+ async def replay_snapshot(self, *, snapshot_id: SnapshotId, from_step: Optional[int] = None, to_step: Optional[int] = None, scale: Optional[float] = None) -> ReplaySnapshotReturn:
152
+ """
153
+ Replays the layer snapshot and returns the resulting bitmap.
154
+ :param snapshot_id: The id of the layer snapshot.
155
+ :param from_step: The first step to replay from (replay from the very start if not specified).
156
+ :param to_step: The last step to replay to (replay till the end if not specified).
157
+ :param scale: The scale to apply while replaying (defaults to 1).
158
+ """
159
+ _params: Dict[str, Any] = {}
160
+ _params['snapshotId'] = encode(FieldMeta('', '', False, 'primitive'), snapshot_id)
161
+ if from_step is not None:
162
+ _params['fromStep'] = encode(FieldMeta('', '', False, 'primitive'), from_step)
163
+ if to_step is not None:
164
+ _params['toStep'] = encode(FieldMeta('', '', False, 'primitive'), to_step)
165
+ if scale is not None:
166
+ _params['scale'] = encode(FieldMeta('', '', False, 'primitive'), scale)
167
+ _result = await self._target.send('LayerTree.replaySnapshot', _params)
168
+ return ReplaySnapshotReturn.from_json(_result)
169
+
170
+ async def snapshot_command_log(self, *, snapshot_id: SnapshotId) -> SnapshotCommandLogReturn:
171
+ """
172
+ Replays the layer snapshot and returns canvas log.
173
+ :param snapshot_id: The id of the layer snapshot.
174
+ """
175
+ _params: Dict[str, Any] = {}
176
+ _params['snapshotId'] = encode(FieldMeta('', '', False, 'primitive'), snapshot_id)
177
+ _result = await self._target.send('LayerTree.snapshotCommandLog', _params)
178
+ return SnapshotCommandLogReturn.from_json(_result)
@@ -0,0 +1,104 @@
1
+ """Custom types and enums for the LayerTree 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 Rect as DOM_Rect
13
+
14
+ type LayerId = str # Unique Layer identifier.
15
+
16
+
17
+ type SnapshotId = str # Unique snapshot identifier.
18
+
19
+
20
+ @register("LayerTree.ScrollRect")
21
+ @dataclass
22
+ class ScrollRect(DataType):
23
+ """Rectangle where scrolling happens on the main thread."""
24
+ rect: DOM_Rect
25
+ type_: Literal['RepaintsOnScroll', 'TouchEventHandler', 'WheelEventHandler']
26
+ __FIELDS__: ClassVar[tuple] = (
27
+ FieldMeta('rect', 'rect', False, 'object', ref='DOM.Rect'),
28
+ FieldMeta('type_', 'type', False, 'primitive'),
29
+ )
30
+
31
+
32
+ @register("LayerTree.StickyPositionConstraint")
33
+ @dataclass
34
+ class StickyPositionConstraint(DataType):
35
+ """Sticky position constraints."""
36
+ sticky_box_rect: DOM_Rect
37
+ containing_block_rect: DOM_Rect
38
+ nearest_layer_shifting_sticky_box: Optional[LayerId] = None
39
+ nearest_layer_shifting_containing_block: Optional[LayerId] = None
40
+ __FIELDS__: ClassVar[tuple] = (
41
+ FieldMeta('sticky_box_rect', 'stickyBoxRect', False, 'object', ref='DOM.Rect'),
42
+ FieldMeta('containing_block_rect', 'containingBlockRect', False, 'object', ref='DOM.Rect'),
43
+ FieldMeta('nearest_layer_shifting_sticky_box', 'nearestLayerShiftingStickyBox', True, 'primitive'),
44
+ FieldMeta('nearest_layer_shifting_containing_block', 'nearestLayerShiftingContainingBlock', True, 'primitive'),
45
+ )
46
+
47
+
48
+ @register("LayerTree.PictureTile")
49
+ @dataclass
50
+ class PictureTile(DataType):
51
+ """Serialized fragment of layer picture along with its offset within the layer."""
52
+ x: float
53
+ y: float
54
+ picture: str
55
+ __FIELDS__: ClassVar[tuple] = (
56
+ FieldMeta('x', 'x', False, 'primitive'),
57
+ FieldMeta('y', 'y', False, 'primitive'),
58
+ FieldMeta('picture', 'picture', False, 'primitive'),
59
+ )
60
+
61
+
62
+ @register("LayerTree.Layer")
63
+ @dataclass
64
+ class Layer(DataType):
65
+ """Information about a compositing layer."""
66
+ layer_id: LayerId
67
+ offset_x: float
68
+ offset_y: float
69
+ width: float
70
+ height: float
71
+ paint_count: int
72
+ draws_content: bool
73
+ parent_layer_id: Optional[LayerId] = None
74
+ backend_node_id: Optional[DOM_BackendNodeId] = None
75
+ transform: Optional[List[float]] = None
76
+ anchor_x: Optional[float] = None
77
+ anchor_y: Optional[float] = None
78
+ anchor_z: Optional[float] = None
79
+ invisible: Optional[bool] = None
80
+ scroll_rects: Optional[List[ScrollRect]] = None
81
+ sticky_position_constraint: Optional[StickyPositionConstraint] = None
82
+ __FIELDS__: ClassVar[tuple] = (
83
+ FieldMeta('layer_id', 'layerId', False, 'primitive'),
84
+ FieldMeta('offset_x', 'offsetX', False, 'primitive'),
85
+ FieldMeta('offset_y', 'offsetY', False, 'primitive'),
86
+ FieldMeta('width', 'width', False, 'primitive'),
87
+ FieldMeta('height', 'height', False, 'primitive'),
88
+ FieldMeta('paint_count', 'paintCount', False, 'primitive'),
89
+ FieldMeta('draws_content', 'drawsContent', False, 'primitive'),
90
+ FieldMeta('parent_layer_id', 'parentLayerId', True, 'primitive'),
91
+ FieldMeta('backend_node_id', 'backendNodeId', True, 'primitive'),
92
+ FieldMeta('transform', 'transform', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
93
+ FieldMeta('anchor_x', 'anchorX', True, 'primitive'),
94
+ FieldMeta('anchor_y', 'anchorY', True, 'primitive'),
95
+ FieldMeta('anchor_z', 'anchorZ', True, 'primitive'),
96
+ FieldMeta('invisible', 'invisible', True, 'primitive'),
97
+ FieldMeta('scroll_rects', 'scrollRects', True, 'array', inner=FieldMeta('', '', False, 'object', ref='LayerTree.ScrollRect')),
98
+ FieldMeta('sticky_position_constraint', 'stickyPositionConstraint', True, 'object', ref='LayerTree.StickyPositionConstraint'),
99
+ )
100
+
101
+
102
+ type PaintProfile = List[float] # Array of timings, one per paint step.
103
+
104
+ __all__ = ["Layer", "LayerId", "PaintProfile", "PictureTile", "ScrollRect", "SnapshotId", "StickyPositionConstraint"]
@@ -0,0 +1,15 @@
1
+ """The Log CDP domain (generated).
2
+
3
+ Importing ``Log`` from ``parsek_cdp.cdp`` gives a namespace with this
4
+ domain's events and types as attributes (``Log.SomeEvent`` /
5
+ ``Log.SomeType``); commands run on a target via ``page.cdp.Log``.
6
+ """
7
+ from . import events, functions, types
8
+ from .functions import Log
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=(Log,)``).
13
+ DOMAIN = "Log"
14
+
15
+ __all__ = ["events", "functions", "types", "Log", "DOMAIN"]
@@ -0,0 +1,22 @@
1
+ """Events for the Log 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 LogEntry
12
+
13
+ @register_event("Log.entryAdded")
14
+ @dataclass
15
+ class EntryAdded(Event):
16
+ """Issued when new message was logged."""
17
+ entry: LogEntry
18
+ __FIELDS__: ClassVar[tuple] = (
19
+ FieldMeta('entry', 'entry', False, 'object', ref='Log.LogEntry'),
20
+ )
21
+
22
+ __all__ = ["EntryAdded"]
@@ -0,0 +1,54 @@
1
+ """Commands for the Log 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 ViolationSetting
11
+
12
+ class Log:
13
+ """Commands of the Log domain, bound to a target."""
14
+
15
+ def __init__(self, target: Any) -> None:
16
+ self._target = target
17
+
18
+
19
+ async def clear(self) -> None:
20
+ """Clears the log."""
21
+ _params: Dict[str, Any] = {}
22
+ _result = await self._target.send('Log.clear', _params)
23
+ return None
24
+
25
+ async def disable(self) -> None:
26
+ """Disables log domain, prevents further log entries from being reported to the client."""
27
+ _params: Dict[str, Any] = {}
28
+ _result = await self._target.send('Log.disable', _params)
29
+ return None
30
+
31
+ async def enable(self) -> None:
32
+ """
33
+ Enables log domain, sends the entries collected so far to the client by means of the
34
+ `entryAdded` notification.
35
+ """
36
+ _params: Dict[str, Any] = {}
37
+ _result = await self._target.send('Log.enable', _params)
38
+ return None
39
+
40
+ async def start_violations_report(self, *, config: List[ViolationSetting]) -> None:
41
+ """
42
+ start violation reporting.
43
+ :param config: Configuration for violations.
44
+ """
45
+ _params: Dict[str, Any] = {}
46
+ _params['config'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Log.ViolationSetting')), config)
47
+ _result = await self._target.send('Log.startViolationsReport', _params)
48
+ return None
49
+
50
+ async def stop_violations_report(self) -> None:
51
+ """Stop violation reporting."""
52
+ _params: Dict[str, Any] = {}
53
+ _result = await self._target.send('Log.stopViolationsReport', _params)
54
+ return None
@@ -0,0 +1,57 @@
1
+ """Custom types and enums for the Log 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 ..network.types import RequestId as Network_RequestId
12
+ from ..runtime.types import RemoteObject as Runtime_RemoteObject
13
+ from ..runtime.types import StackTrace as Runtime_StackTrace
14
+ from ..runtime.types import Timestamp as Runtime_Timestamp
15
+
16
+ @register("Log.LogEntry")
17
+ @dataclass
18
+ class LogEntry(DataType):
19
+ """Log entry."""
20
+ source: Literal['xml', 'javascript', 'network', 'storage', 'appcache', 'rendering', 'security', 'deprecation', 'worker', 'violation', 'intervention', 'recommendation', 'other']
21
+ level: Literal['verbose', 'info', 'warning', 'error']
22
+ text: str
23
+ timestamp: Runtime_Timestamp
24
+ category: Optional[Literal['cors']] = None
25
+ url: Optional[str] = None
26
+ line_number: Optional[int] = None
27
+ stack_trace: Optional[Runtime_StackTrace] = None
28
+ network_request_id: Optional[Network_RequestId] = None
29
+ worker_id: Optional[str] = None
30
+ args: Optional[List[Runtime_RemoteObject]] = None
31
+ __FIELDS__: ClassVar[tuple] = (
32
+ FieldMeta('source', 'source', False, 'primitive'),
33
+ FieldMeta('level', 'level', False, 'primitive'),
34
+ FieldMeta('text', 'text', False, 'primitive'),
35
+ FieldMeta('timestamp', 'timestamp', False, 'primitive'),
36
+ FieldMeta('category', 'category', True, 'primitive'),
37
+ FieldMeta('url', 'url', True, 'primitive'),
38
+ FieldMeta('line_number', 'lineNumber', True, 'primitive'),
39
+ FieldMeta('stack_trace', 'stackTrace', True, 'object', ref='Runtime.StackTrace'),
40
+ FieldMeta('network_request_id', 'networkRequestId', True, 'primitive'),
41
+ FieldMeta('worker_id', 'workerId', True, 'primitive'),
42
+ FieldMeta('args', 'args', True, 'array', inner=FieldMeta('', '', False, 'object', ref='Runtime.RemoteObject')),
43
+ )
44
+
45
+
46
+ @register("Log.ViolationSetting")
47
+ @dataclass
48
+ class ViolationSetting(DataType):
49
+ """Violation configuration setting."""
50
+ name: Literal['longTask', 'longLayout', 'blockedEvent', 'blockedParser', 'discouragedAPIUse', 'handler', 'recurringHandler']
51
+ threshold: float
52
+ __FIELDS__: ClassVar[tuple] = (
53
+ FieldMeta('name', 'name', False, 'primitive'),
54
+ FieldMeta('threshold', 'threshold', False, 'primitive'),
55
+ )
56
+
57
+ __all__ = ["LogEntry", "ViolationSetting"]
@@ -0,0 +1,15 @@
1
+ """The Media CDP domain (generated).
2
+
3
+ Importing ``Media`` from ``parsek_cdp.cdp`` gives a namespace with this
4
+ domain's events and types as attributes (``Media.SomeEvent`` /
5
+ ``Media.SomeType``); commands run on a target via ``page.cdp.Media``.
6
+ """
7
+ from . import events, functions, types
8
+ from .functions import Media
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=(Media,)``).
13
+ DOMAIN = "Media"
14
+
15
+ __all__ = ["events", "functions", "types", "Media", "DOMAIN"]