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,688 @@
|
|
|
1
|
+
"""Commands for the Emulation 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
|
+
DevicePosture,
|
|
12
|
+
DisabledImageType,
|
|
13
|
+
DisplayFeature,
|
|
14
|
+
MediaFeature,
|
|
15
|
+
PressureMetadata,
|
|
16
|
+
PressureSource,
|
|
17
|
+
PressureState,
|
|
18
|
+
SafeAreaInsets,
|
|
19
|
+
ScreenId,
|
|
20
|
+
ScreenInfo,
|
|
21
|
+
ScreenOrientation,
|
|
22
|
+
SensorMetadata,
|
|
23
|
+
SensorReading,
|
|
24
|
+
SensorType,
|
|
25
|
+
UserAgentMetadata,
|
|
26
|
+
VirtualTimePolicy,
|
|
27
|
+
WorkAreaInsets,
|
|
28
|
+
)
|
|
29
|
+
from ..dom.types import RGBA as DOM_RGBA
|
|
30
|
+
from ..network.types import TimeSinceEpoch as Network_TimeSinceEpoch
|
|
31
|
+
from ..page.types import Viewport as Page_Viewport
|
|
32
|
+
|
|
33
|
+
@dataclass
|
|
34
|
+
class CanEmulateReturn(DataType):
|
|
35
|
+
"""Return value of :meth:`Emulation.can_emulate`."""
|
|
36
|
+
result: bool
|
|
37
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
38
|
+
FieldMeta('result', 'result', False, 'primitive'),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass
|
|
43
|
+
class GetOverriddenSensorInformationReturn(DataType):
|
|
44
|
+
"""Return value of :meth:`Emulation.get_overridden_sensor_information`."""
|
|
45
|
+
requested_sampling_frequency: float
|
|
46
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
47
|
+
FieldMeta('requested_sampling_frequency', 'requestedSamplingFrequency', False, 'primitive'),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass
|
|
52
|
+
class SetVirtualTimePolicyReturn(DataType):
|
|
53
|
+
"""Return value of :meth:`Emulation.set_virtual_time_policy`."""
|
|
54
|
+
virtual_time_ticks_base: float
|
|
55
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
56
|
+
FieldMeta('virtual_time_ticks_base', 'virtualTimeTicksBase', False, 'primitive'),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass
|
|
61
|
+
class GetScreenInfosReturn(DataType):
|
|
62
|
+
"""Return value of :meth:`Emulation.get_screen_infos`."""
|
|
63
|
+
screen_infos: List[ScreenInfo]
|
|
64
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
65
|
+
FieldMeta('screen_infos', 'screenInfos', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Emulation.ScreenInfo')),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class AddScreenReturn(DataType):
|
|
71
|
+
"""Return value of :meth:`Emulation.add_screen`."""
|
|
72
|
+
screen_info: ScreenInfo
|
|
73
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
74
|
+
FieldMeta('screen_info', 'screenInfo', False, 'object', ref='Emulation.ScreenInfo'),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class Emulation:
|
|
79
|
+
"""Commands of the Emulation domain, bound to a target."""
|
|
80
|
+
|
|
81
|
+
def __init__(self, target: Any) -> None:
|
|
82
|
+
self._target = target
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
async def can_emulate(self) -> CanEmulateReturn:
|
|
86
|
+
"""
|
|
87
|
+
Tells whether emulation is supported.
|
|
88
|
+
|
|
89
|
+
.. deprecated::
|
|
90
|
+
"""
|
|
91
|
+
_params: Dict[str, Any] = {}
|
|
92
|
+
_result = await self._target.send('Emulation.canEmulate', _params)
|
|
93
|
+
return CanEmulateReturn.from_json(_result)
|
|
94
|
+
|
|
95
|
+
async def clear_device_metrics_override(self) -> None:
|
|
96
|
+
"""Clears the overridden device metrics."""
|
|
97
|
+
_params: Dict[str, Any] = {}
|
|
98
|
+
_result = await self._target.send('Emulation.clearDeviceMetricsOverride', _params)
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
async def clear_geolocation_override(self) -> None:
|
|
102
|
+
"""Clears the overridden Geolocation Position and Error."""
|
|
103
|
+
_params: Dict[str, Any] = {}
|
|
104
|
+
_result = await self._target.send('Emulation.clearGeolocationOverride', _params)
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
async def reset_page_scale_factor(self) -> None:
|
|
108
|
+
"""Requests that page scale factor is reset to initial values."""
|
|
109
|
+
_params: Dict[str, Any] = {}
|
|
110
|
+
_result = await self._target.send('Emulation.resetPageScaleFactor', _params)
|
|
111
|
+
return None
|
|
112
|
+
|
|
113
|
+
async def set_focus_emulation_enabled(self, *, enabled: bool) -> None:
|
|
114
|
+
"""
|
|
115
|
+
Enables or disables simulating a focused and active page.
|
|
116
|
+
:param enabled: Whether to enable to disable focus emulation.
|
|
117
|
+
"""
|
|
118
|
+
_params: Dict[str, Any] = {}
|
|
119
|
+
_params['enabled'] = encode(FieldMeta('', '', False, 'primitive'), enabled)
|
|
120
|
+
_result = await self._target.send('Emulation.setFocusEmulationEnabled', _params)
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
async def set_auto_dark_mode_override(self, *, enabled: Optional[bool] = None) -> None:
|
|
124
|
+
"""
|
|
125
|
+
Automatically render all web contents using a dark theme.
|
|
126
|
+
:param enabled: Whether to enable or disable automatic dark mode.
|
|
127
|
+
If not specified, any existing override will be cleared.
|
|
128
|
+
"""
|
|
129
|
+
_params: Dict[str, Any] = {}
|
|
130
|
+
if enabled is not None:
|
|
131
|
+
_params['enabled'] = encode(FieldMeta('', '', False, 'primitive'), enabled)
|
|
132
|
+
_result = await self._target.send('Emulation.setAutoDarkModeOverride', _params)
|
|
133
|
+
return None
|
|
134
|
+
|
|
135
|
+
async def set_cpu_throttling_rate(self, *, rate: float) -> None:
|
|
136
|
+
"""
|
|
137
|
+
Enables CPU throttling to emulate slow CPUs.
|
|
138
|
+
:param rate: Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
|
|
139
|
+
"""
|
|
140
|
+
_params: Dict[str, Any] = {}
|
|
141
|
+
_params['rate'] = encode(FieldMeta('', '', False, 'primitive'), rate)
|
|
142
|
+
_result = await self._target.send('Emulation.setCPUThrottlingRate', _params)
|
|
143
|
+
return None
|
|
144
|
+
|
|
145
|
+
async def set_default_background_color_override(self, *, color: Optional[DOM_RGBA] = None) -> None:
|
|
146
|
+
"""
|
|
147
|
+
Sets or clears an override of the default background color of the frame. This override is used
|
|
148
|
+
if the content does not specify one.
|
|
149
|
+
:param color: RGBA of the default background color. If not specified, any existing override will be
|
|
150
|
+
cleared.
|
|
151
|
+
"""
|
|
152
|
+
_params: Dict[str, Any] = {}
|
|
153
|
+
if color is not None:
|
|
154
|
+
_params['color'] = encode(FieldMeta('', '', False, 'object', ref='DOM.RGBA'), color)
|
|
155
|
+
_result = await self._target.send('Emulation.setDefaultBackgroundColorOverride', _params)
|
|
156
|
+
return None
|
|
157
|
+
|
|
158
|
+
async def set_safe_area_insets_override(self, *, insets: SafeAreaInsets) -> None:
|
|
159
|
+
"""
|
|
160
|
+
Overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the
|
|
161
|
+
respective variables to be undefined, even if previously overridden.
|
|
162
|
+
:param insets:
|
|
163
|
+
"""
|
|
164
|
+
_params: Dict[str, Any] = {}
|
|
165
|
+
_params['insets'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.SafeAreaInsets'), insets)
|
|
166
|
+
_result = await self._target.send('Emulation.setSafeAreaInsetsOverride', _params)
|
|
167
|
+
return None
|
|
168
|
+
|
|
169
|
+
async def set_device_metrics_override(self, *, width: int, height: int, device_scale_factor: float, mobile: bool, scale: Optional[float] = None, screen_width: Optional[int] = None, screen_height: Optional[int] = None, position_x: Optional[int] = None, position_y: Optional[int] = None, dont_set_visible_size: Optional[bool] = None, screen_orientation: Optional[ScreenOrientation] = None, viewport: Optional[Page_Viewport] = None, display_feature: Optional[DisplayFeature] = None, device_posture: Optional[DevicePosture] = None) -> None:
|
|
170
|
+
"""
|
|
171
|
+
Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
|
|
172
|
+
window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
|
|
173
|
+
query results).
|
|
174
|
+
:param width: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
|
|
175
|
+
:param height: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
|
|
176
|
+
:param device_scale_factor: Overriding device scale factor value. 0 disables the override.
|
|
177
|
+
:param mobile: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text
|
|
178
|
+
autosizing and more.
|
|
179
|
+
:param scale: Scale to apply to resulting view image.
|
|
180
|
+
:param screen_width: Overriding screen width value in pixels (minimum 0, maximum 10000000).
|
|
181
|
+
:param screen_height: Overriding screen height value in pixels (minimum 0, maximum 10000000).
|
|
182
|
+
:param position_x: Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
|
|
183
|
+
:param position_y: Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
|
|
184
|
+
:param dont_set_visible_size: Do not set visible view size, rely upon explicit setVisibleSize call.
|
|
185
|
+
:param screen_orientation: Screen orientation override.
|
|
186
|
+
:param viewport: If set, the visible area of the page will be overridden to this viewport. This viewport
|
|
187
|
+
change is not observed by the page, e.g. viewport-relative elements do not change positions.
|
|
188
|
+
:param display_feature: If set, the display feature of a multi-segment screen. If not set, multi-segment support
|
|
189
|
+
is turned-off.
|
|
190
|
+
Deprecated, use Emulation.setDisplayFeaturesOverride.
|
|
191
|
+
:param device_posture: If set, the posture of a foldable device. If not set the posture is set
|
|
192
|
+
to continuous.
|
|
193
|
+
Deprecated, use Emulation.setDevicePostureOverride.
|
|
194
|
+
"""
|
|
195
|
+
_params: Dict[str, Any] = {}
|
|
196
|
+
_params['width'] = encode(FieldMeta('', '', False, 'primitive'), width)
|
|
197
|
+
_params['height'] = encode(FieldMeta('', '', False, 'primitive'), height)
|
|
198
|
+
_params['deviceScaleFactor'] = encode(FieldMeta('', '', False, 'primitive'), device_scale_factor)
|
|
199
|
+
_params['mobile'] = encode(FieldMeta('', '', False, 'primitive'), mobile)
|
|
200
|
+
if scale is not None:
|
|
201
|
+
_params['scale'] = encode(FieldMeta('', '', False, 'primitive'), scale)
|
|
202
|
+
if screen_width is not None:
|
|
203
|
+
_params['screenWidth'] = encode(FieldMeta('', '', False, 'primitive'), screen_width)
|
|
204
|
+
if screen_height is not None:
|
|
205
|
+
_params['screenHeight'] = encode(FieldMeta('', '', False, 'primitive'), screen_height)
|
|
206
|
+
if position_x is not None:
|
|
207
|
+
_params['positionX'] = encode(FieldMeta('', '', False, 'primitive'), position_x)
|
|
208
|
+
if position_y is not None:
|
|
209
|
+
_params['positionY'] = encode(FieldMeta('', '', False, 'primitive'), position_y)
|
|
210
|
+
if dont_set_visible_size is not None:
|
|
211
|
+
_params['dontSetVisibleSize'] = encode(FieldMeta('', '', False, 'primitive'), dont_set_visible_size)
|
|
212
|
+
if screen_orientation is not None:
|
|
213
|
+
_params['screenOrientation'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.ScreenOrientation'), screen_orientation)
|
|
214
|
+
if viewport is not None:
|
|
215
|
+
_params['viewport'] = encode(FieldMeta('', '', False, 'object', ref='Page.Viewport'), viewport)
|
|
216
|
+
if display_feature is not None:
|
|
217
|
+
_params['displayFeature'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.DisplayFeature'), display_feature)
|
|
218
|
+
if device_posture is not None:
|
|
219
|
+
_params['devicePosture'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.DevicePosture'), device_posture)
|
|
220
|
+
_result = await self._target.send('Emulation.setDeviceMetricsOverride', _params)
|
|
221
|
+
return None
|
|
222
|
+
|
|
223
|
+
async def set_device_posture_override(self, *, posture: DevicePosture) -> None:
|
|
224
|
+
"""
|
|
225
|
+
Start reporting the given posture value to the Device Posture API.
|
|
226
|
+
This override can also be set in setDeviceMetricsOverride().
|
|
227
|
+
:param posture:
|
|
228
|
+
"""
|
|
229
|
+
_params: Dict[str, Any] = {}
|
|
230
|
+
_params['posture'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.DevicePosture'), posture)
|
|
231
|
+
_result = await self._target.send('Emulation.setDevicePostureOverride', _params)
|
|
232
|
+
return None
|
|
233
|
+
|
|
234
|
+
async def clear_device_posture_override(self) -> None:
|
|
235
|
+
"""
|
|
236
|
+
Clears a device posture override set with either setDeviceMetricsOverride()
|
|
237
|
+
or setDevicePostureOverride() and starts using posture information from the
|
|
238
|
+
platform again.
|
|
239
|
+
Does nothing if no override is set.
|
|
240
|
+
"""
|
|
241
|
+
_params: Dict[str, Any] = {}
|
|
242
|
+
_result = await self._target.send('Emulation.clearDevicePostureOverride', _params)
|
|
243
|
+
return None
|
|
244
|
+
|
|
245
|
+
async def set_display_features_override(self, *, features: List[DisplayFeature]) -> None:
|
|
246
|
+
"""
|
|
247
|
+
Start using the given display features to pupulate the Viewport Segments API.
|
|
248
|
+
This override can also be set in setDeviceMetricsOverride().
|
|
249
|
+
:param features:
|
|
250
|
+
"""
|
|
251
|
+
_params: Dict[str, Any] = {}
|
|
252
|
+
_params['features'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Emulation.DisplayFeature')), features)
|
|
253
|
+
_result = await self._target.send('Emulation.setDisplayFeaturesOverride', _params)
|
|
254
|
+
return None
|
|
255
|
+
|
|
256
|
+
async def clear_display_features_override(self) -> None:
|
|
257
|
+
"""
|
|
258
|
+
Clears the display features override set with either setDeviceMetricsOverride()
|
|
259
|
+
or setDisplayFeaturesOverride() and starts using display features from the
|
|
260
|
+
platform again.
|
|
261
|
+
Does nothing if no override is set.
|
|
262
|
+
"""
|
|
263
|
+
_params: Dict[str, Any] = {}
|
|
264
|
+
_result = await self._target.send('Emulation.clearDisplayFeaturesOverride', _params)
|
|
265
|
+
return None
|
|
266
|
+
|
|
267
|
+
async def set_scrollbars_hidden(self, *, hidden: bool) -> None:
|
|
268
|
+
""":param hidden: Whether scrollbars should be always hidden."""
|
|
269
|
+
_params: Dict[str, Any] = {}
|
|
270
|
+
_params['hidden'] = encode(FieldMeta('', '', False, 'primitive'), hidden)
|
|
271
|
+
_result = await self._target.send('Emulation.setScrollbarsHidden', _params)
|
|
272
|
+
return None
|
|
273
|
+
|
|
274
|
+
async def set_document_cookie_disabled(self, *, disabled: bool) -> None:
|
|
275
|
+
""":param disabled: Whether document.coookie API should be disabled."""
|
|
276
|
+
_params: Dict[str, Any] = {}
|
|
277
|
+
_params['disabled'] = encode(FieldMeta('', '', False, 'primitive'), disabled)
|
|
278
|
+
_result = await self._target.send('Emulation.setDocumentCookieDisabled', _params)
|
|
279
|
+
return None
|
|
280
|
+
|
|
281
|
+
async def set_emit_touch_events_for_mouse(self, *, enabled: bool, configuration: Optional[Literal['mobile', 'desktop']] = None) -> None:
|
|
282
|
+
"""
|
|
283
|
+
:param enabled: Whether touch emulation based on mouse input should be enabled.
|
|
284
|
+
:param configuration: Touch/gesture events configuration. Default: current platform.
|
|
285
|
+
"""
|
|
286
|
+
_params: Dict[str, Any] = {}
|
|
287
|
+
_params['enabled'] = encode(FieldMeta('', '', False, 'primitive'), enabled)
|
|
288
|
+
if configuration is not None:
|
|
289
|
+
_params['configuration'] = encode(FieldMeta('', '', False, 'primitive'), configuration)
|
|
290
|
+
_result = await self._target.send('Emulation.setEmitTouchEventsForMouse', _params)
|
|
291
|
+
return None
|
|
292
|
+
|
|
293
|
+
async def set_emulated_media(self, *, media: Optional[str] = None, features: Optional[List[MediaFeature]] = None) -> None:
|
|
294
|
+
"""
|
|
295
|
+
Emulates the given media type or media feature for CSS media queries.
|
|
296
|
+
:param media: Media type to emulate. Empty string disables the override.
|
|
297
|
+
:param features: Media features to emulate.
|
|
298
|
+
"""
|
|
299
|
+
_params: Dict[str, Any] = {}
|
|
300
|
+
if media is not None:
|
|
301
|
+
_params['media'] = encode(FieldMeta('', '', False, 'primitive'), media)
|
|
302
|
+
if features is not None:
|
|
303
|
+
_params['features'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Emulation.MediaFeature')), features)
|
|
304
|
+
_result = await self._target.send('Emulation.setEmulatedMedia', _params)
|
|
305
|
+
return None
|
|
306
|
+
|
|
307
|
+
async def set_emulated_vision_deficiency(self, *, type_: Literal['none', 'blurredVision', 'reducedContrast', 'achromatopsia', 'deuteranopia', 'protanopia', 'tritanopia']) -> None:
|
|
308
|
+
"""
|
|
309
|
+
Emulates the given vision deficiency.
|
|
310
|
+
:param type_: Vision deficiency to emulate. Order: best-effort emulations come first, followed by any
|
|
311
|
+
physiologically accurate emulations for medically recognized color vision deficiencies.
|
|
312
|
+
"""
|
|
313
|
+
_params: Dict[str, Any] = {}
|
|
314
|
+
_params['type'] = encode(FieldMeta('', '', False, 'primitive'), type_)
|
|
315
|
+
_result = await self._target.send('Emulation.setEmulatedVisionDeficiency', _params)
|
|
316
|
+
return None
|
|
317
|
+
|
|
318
|
+
async def set_emulated_os_text_scale(self, *, scale: Optional[float] = None) -> None:
|
|
319
|
+
"""
|
|
320
|
+
Emulates the given OS text scale.
|
|
321
|
+
:param scale:
|
|
322
|
+
"""
|
|
323
|
+
_params: Dict[str, Any] = {}
|
|
324
|
+
if scale is not None:
|
|
325
|
+
_params['scale'] = encode(FieldMeta('', '', False, 'primitive'), scale)
|
|
326
|
+
_result = await self._target.send('Emulation.setEmulatedOSTextScale', _params)
|
|
327
|
+
return None
|
|
328
|
+
|
|
329
|
+
async def set_geolocation_override(self, *, latitude: Optional[float] = None, longitude: Optional[float] = None, accuracy: Optional[float] = None, altitude: Optional[float] = None, altitude_accuracy: Optional[float] = None, heading: Optional[float] = None, speed: Optional[float] = None) -> None:
|
|
330
|
+
"""
|
|
331
|
+
Overrides the Geolocation Position or Error. Omitting latitude, longitude or
|
|
332
|
+
accuracy emulates position unavailable.
|
|
333
|
+
:param latitude: Mock latitude
|
|
334
|
+
:param longitude: Mock longitude
|
|
335
|
+
:param accuracy: Mock accuracy
|
|
336
|
+
:param altitude: Mock altitude
|
|
337
|
+
:param altitude_accuracy: Mock altitudeAccuracy
|
|
338
|
+
:param heading: Mock heading
|
|
339
|
+
:param speed: Mock speed
|
|
340
|
+
"""
|
|
341
|
+
_params: Dict[str, Any] = {}
|
|
342
|
+
if latitude is not None:
|
|
343
|
+
_params['latitude'] = encode(FieldMeta('', '', False, 'primitive'), latitude)
|
|
344
|
+
if longitude is not None:
|
|
345
|
+
_params['longitude'] = encode(FieldMeta('', '', False, 'primitive'), longitude)
|
|
346
|
+
if accuracy is not None:
|
|
347
|
+
_params['accuracy'] = encode(FieldMeta('', '', False, 'primitive'), accuracy)
|
|
348
|
+
if altitude is not None:
|
|
349
|
+
_params['altitude'] = encode(FieldMeta('', '', False, 'primitive'), altitude)
|
|
350
|
+
if altitude_accuracy is not None:
|
|
351
|
+
_params['altitudeAccuracy'] = encode(FieldMeta('', '', False, 'primitive'), altitude_accuracy)
|
|
352
|
+
if heading is not None:
|
|
353
|
+
_params['heading'] = encode(FieldMeta('', '', False, 'primitive'), heading)
|
|
354
|
+
if speed is not None:
|
|
355
|
+
_params['speed'] = encode(FieldMeta('', '', False, 'primitive'), speed)
|
|
356
|
+
_result = await self._target.send('Emulation.setGeolocationOverride', _params)
|
|
357
|
+
return None
|
|
358
|
+
|
|
359
|
+
async def get_overridden_sensor_information(self, *, type_: SensorType) -> GetOverriddenSensorInformationReturn:
|
|
360
|
+
""":param type_:"""
|
|
361
|
+
_params: Dict[str, Any] = {}
|
|
362
|
+
_params['type'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.SensorType'), type_)
|
|
363
|
+
_result = await self._target.send('Emulation.getOverriddenSensorInformation', _params)
|
|
364
|
+
return GetOverriddenSensorInformationReturn.from_json(_result)
|
|
365
|
+
|
|
366
|
+
async def set_sensor_override_enabled(self, *, enabled: bool, type_: SensorType, metadata: Optional[SensorMetadata] = None) -> None:
|
|
367
|
+
"""
|
|
368
|
+
Overrides a platform sensor of a given type. If |enabled| is true, calls to
|
|
369
|
+
Sensor.start() will use a virtual sensor as backend rather than fetching
|
|
370
|
+
data from a real hardware sensor. Otherwise, existing virtual
|
|
371
|
+
sensor-backend Sensor objects will fire an error event and new calls to
|
|
372
|
+
Sensor.start() will attempt to use a real sensor instead.
|
|
373
|
+
:param enabled:
|
|
374
|
+
:param type_:
|
|
375
|
+
:param metadata:
|
|
376
|
+
"""
|
|
377
|
+
_params: Dict[str, Any] = {}
|
|
378
|
+
_params['enabled'] = encode(FieldMeta('', '', False, 'primitive'), enabled)
|
|
379
|
+
_params['type'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.SensorType'), type_)
|
|
380
|
+
if metadata is not None:
|
|
381
|
+
_params['metadata'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.SensorMetadata'), metadata)
|
|
382
|
+
_result = await self._target.send('Emulation.setSensorOverrideEnabled', _params)
|
|
383
|
+
return None
|
|
384
|
+
|
|
385
|
+
async def set_sensor_override_readings(self, *, type_: SensorType, reading: SensorReading) -> None:
|
|
386
|
+
"""
|
|
387
|
+
Updates the sensor readings reported by a sensor type previously overridden
|
|
388
|
+
by setSensorOverrideEnabled.
|
|
389
|
+
:param type_:
|
|
390
|
+
:param reading:
|
|
391
|
+
"""
|
|
392
|
+
_params: Dict[str, Any] = {}
|
|
393
|
+
_params['type'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.SensorType'), type_)
|
|
394
|
+
_params['reading'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.SensorReading'), reading)
|
|
395
|
+
_result = await self._target.send('Emulation.setSensorOverrideReadings', _params)
|
|
396
|
+
return None
|
|
397
|
+
|
|
398
|
+
async def set_pressure_source_override_enabled(self, *, enabled: bool, source: PressureSource, metadata: Optional[PressureMetadata] = None) -> None:
|
|
399
|
+
"""
|
|
400
|
+
Overrides a pressure source of a given type, as used by the Compute
|
|
401
|
+
Pressure API, so that updates to PressureObserver.observe() are provided
|
|
402
|
+
via setPressureStateOverride instead of being retrieved from
|
|
403
|
+
platform-provided telemetry data.
|
|
404
|
+
:param enabled:
|
|
405
|
+
:param source:
|
|
406
|
+
:param metadata:
|
|
407
|
+
"""
|
|
408
|
+
_params: Dict[str, Any] = {}
|
|
409
|
+
_params['enabled'] = encode(FieldMeta('', '', False, 'primitive'), enabled)
|
|
410
|
+
_params['source'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.PressureSource'), source)
|
|
411
|
+
if metadata is not None:
|
|
412
|
+
_params['metadata'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.PressureMetadata'), metadata)
|
|
413
|
+
_result = await self._target.send('Emulation.setPressureSourceOverrideEnabled', _params)
|
|
414
|
+
return None
|
|
415
|
+
|
|
416
|
+
async def set_pressure_state_override(self, *, source: PressureSource, state: PressureState) -> None:
|
|
417
|
+
"""
|
|
418
|
+
TODO: OBSOLETE: To remove when setPressureDataOverride is merged.
|
|
419
|
+
Provides a given pressure state that will be processed and eventually be
|
|
420
|
+
delivered to PressureObserver users. |source| must have been previously
|
|
421
|
+
overridden by setPressureSourceOverrideEnabled.
|
|
422
|
+
:param source:
|
|
423
|
+
:param state:
|
|
424
|
+
"""
|
|
425
|
+
_params: Dict[str, Any] = {}
|
|
426
|
+
_params['source'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.PressureSource'), source)
|
|
427
|
+
_params['state'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.PressureState'), state)
|
|
428
|
+
_result = await self._target.send('Emulation.setPressureStateOverride', _params)
|
|
429
|
+
return None
|
|
430
|
+
|
|
431
|
+
async def set_pressure_data_override(self, *, source: PressureSource, state: PressureState, own_contribution_estimate: Optional[float] = None) -> None:
|
|
432
|
+
"""
|
|
433
|
+
Provides a given pressure data set that will be processed and eventually be
|
|
434
|
+
delivered to PressureObserver users. |source| must have been previously
|
|
435
|
+
overridden by setPressureSourceOverrideEnabled.
|
|
436
|
+
:param source:
|
|
437
|
+
:param state:
|
|
438
|
+
:param own_contribution_estimate:
|
|
439
|
+
"""
|
|
440
|
+
_params: Dict[str, Any] = {}
|
|
441
|
+
_params['source'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.PressureSource'), source)
|
|
442
|
+
_params['state'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.PressureState'), state)
|
|
443
|
+
if own_contribution_estimate is not None:
|
|
444
|
+
_params['ownContributionEstimate'] = encode(FieldMeta('', '', False, 'primitive'), own_contribution_estimate)
|
|
445
|
+
_result = await self._target.send('Emulation.setPressureDataOverride', _params)
|
|
446
|
+
return None
|
|
447
|
+
|
|
448
|
+
async def set_idle_override(self, *, is_user_active: bool, is_screen_unlocked: bool) -> None:
|
|
449
|
+
"""
|
|
450
|
+
Overrides the Idle state.
|
|
451
|
+
:param is_user_active: Mock isUserActive
|
|
452
|
+
:param is_screen_unlocked: Mock isScreenUnlocked
|
|
453
|
+
"""
|
|
454
|
+
_params: Dict[str, Any] = {}
|
|
455
|
+
_params['isUserActive'] = encode(FieldMeta('', '', False, 'primitive'), is_user_active)
|
|
456
|
+
_params['isScreenUnlocked'] = encode(FieldMeta('', '', False, 'primitive'), is_screen_unlocked)
|
|
457
|
+
_result = await self._target.send('Emulation.setIdleOverride', _params)
|
|
458
|
+
return None
|
|
459
|
+
|
|
460
|
+
async def clear_idle_override(self) -> None:
|
|
461
|
+
"""Clears Idle state overrides."""
|
|
462
|
+
_params: Dict[str, Any] = {}
|
|
463
|
+
_result = await self._target.send('Emulation.clearIdleOverride', _params)
|
|
464
|
+
return None
|
|
465
|
+
|
|
466
|
+
async def set_navigator_overrides(self, *, platform: str) -> None:
|
|
467
|
+
"""
|
|
468
|
+
Overrides value returned by the javascript navigator object.
|
|
469
|
+
|
|
470
|
+
.. deprecated::
|
|
471
|
+
:param platform: The platform navigator.platform should return.
|
|
472
|
+
"""
|
|
473
|
+
_params: Dict[str, Any] = {}
|
|
474
|
+
_params['platform'] = encode(FieldMeta('', '', False, 'primitive'), platform)
|
|
475
|
+
_result = await self._target.send('Emulation.setNavigatorOverrides', _params)
|
|
476
|
+
return None
|
|
477
|
+
|
|
478
|
+
async def set_page_scale_factor(self, *, page_scale_factor: float) -> None:
|
|
479
|
+
"""
|
|
480
|
+
Sets a specified page scale factor.
|
|
481
|
+
:param page_scale_factor: Page scale factor.
|
|
482
|
+
"""
|
|
483
|
+
_params: Dict[str, Any] = {}
|
|
484
|
+
_params['pageScaleFactor'] = encode(FieldMeta('', '', False, 'primitive'), page_scale_factor)
|
|
485
|
+
_result = await self._target.send('Emulation.setPageScaleFactor', _params)
|
|
486
|
+
return None
|
|
487
|
+
|
|
488
|
+
async def set_script_execution_disabled(self, *, value: bool) -> None:
|
|
489
|
+
"""
|
|
490
|
+
Switches script execution in the page.
|
|
491
|
+
:param value: Whether script execution should be disabled in the page.
|
|
492
|
+
"""
|
|
493
|
+
_params: Dict[str, Any] = {}
|
|
494
|
+
_params['value'] = encode(FieldMeta('', '', False, 'primitive'), value)
|
|
495
|
+
_result = await self._target.send('Emulation.setScriptExecutionDisabled', _params)
|
|
496
|
+
return None
|
|
497
|
+
|
|
498
|
+
async def set_touch_emulation_enabled(self, *, enabled: bool, max_touch_points: Optional[int] = None) -> None:
|
|
499
|
+
"""
|
|
500
|
+
Enables touch on platforms which do not support them.
|
|
501
|
+
:param enabled: Whether the touch event emulation should be enabled.
|
|
502
|
+
:param max_touch_points: Maximum touch points supported. Defaults to one.
|
|
503
|
+
"""
|
|
504
|
+
_params: Dict[str, Any] = {}
|
|
505
|
+
_params['enabled'] = encode(FieldMeta('', '', False, 'primitive'), enabled)
|
|
506
|
+
if max_touch_points is not None:
|
|
507
|
+
_params['maxTouchPoints'] = encode(FieldMeta('', '', False, 'primitive'), max_touch_points)
|
|
508
|
+
_result = await self._target.send('Emulation.setTouchEmulationEnabled', _params)
|
|
509
|
+
return None
|
|
510
|
+
|
|
511
|
+
async def set_virtual_time_policy(self, *, policy: VirtualTimePolicy, budget: Optional[float] = None, max_virtual_time_task_starvation_count: Optional[int] = None, initial_virtual_time: Optional[Network_TimeSinceEpoch] = None) -> SetVirtualTimePolicyReturn:
|
|
512
|
+
"""
|
|
513
|
+
Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
|
|
514
|
+
the current virtual time policy. Note this supersedes any previous time budget.
|
|
515
|
+
:param policy:
|
|
516
|
+
:param budget: If set, after this many virtual milliseconds have elapsed virtual time will be paused and a
|
|
517
|
+
virtualTimeBudgetExpired event is sent.
|
|
518
|
+
:param max_virtual_time_task_starvation_count: If set this specifies the maximum number of tasks that can be run before virtual is forced
|
|
519
|
+
forwards to prevent deadlock.
|
|
520
|
+
:param initial_virtual_time: If set, base::Time::Now will be overridden to initially return this value.
|
|
521
|
+
"""
|
|
522
|
+
_params: Dict[str, Any] = {}
|
|
523
|
+
_params['policy'] = encode(FieldMeta('', '', False, 'enum', ref='Emulation.VirtualTimePolicy'), policy)
|
|
524
|
+
if budget is not None:
|
|
525
|
+
_params['budget'] = encode(FieldMeta('', '', False, 'primitive'), budget)
|
|
526
|
+
if max_virtual_time_task_starvation_count is not None:
|
|
527
|
+
_params['maxVirtualTimeTaskStarvationCount'] = encode(FieldMeta('', '', False, 'primitive'), max_virtual_time_task_starvation_count)
|
|
528
|
+
if initial_virtual_time is not None:
|
|
529
|
+
_params['initialVirtualTime'] = encode(FieldMeta('', '', False, 'primitive'), initial_virtual_time)
|
|
530
|
+
_result = await self._target.send('Emulation.setVirtualTimePolicy', _params)
|
|
531
|
+
return SetVirtualTimePolicyReturn.from_json(_result)
|
|
532
|
+
|
|
533
|
+
async def set_locale_override(self, *, locale: Optional[str] = None) -> None:
|
|
534
|
+
"""
|
|
535
|
+
Overrides default host system locale with the specified one.
|
|
536
|
+
:param locale: ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and
|
|
537
|
+
restores default host system locale.
|
|
538
|
+
"""
|
|
539
|
+
_params: Dict[str, Any] = {}
|
|
540
|
+
if locale is not None:
|
|
541
|
+
_params['locale'] = encode(FieldMeta('', '', False, 'primitive'), locale)
|
|
542
|
+
_result = await self._target.send('Emulation.setLocaleOverride', _params)
|
|
543
|
+
return None
|
|
544
|
+
|
|
545
|
+
async def set_timezone_override(self, *, timezone_id: str) -> None:
|
|
546
|
+
"""
|
|
547
|
+
Overrides default host system timezone with the specified one.
|
|
548
|
+
:param timezone_id: The timezone identifier. List of supported timezones:
|
|
549
|
+
https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt
|
|
550
|
+
If empty, disables the override and restores default host system timezone.
|
|
551
|
+
"""
|
|
552
|
+
_params: Dict[str, Any] = {}
|
|
553
|
+
_params['timezoneId'] = encode(FieldMeta('', '', False, 'primitive'), timezone_id)
|
|
554
|
+
_result = await self._target.send('Emulation.setTimezoneOverride', _params)
|
|
555
|
+
return None
|
|
556
|
+
|
|
557
|
+
async def set_visible_size(self, *, width: int, height: int) -> None:
|
|
558
|
+
"""
|
|
559
|
+
Resizes the frame/viewport of the page. Note that this does not affect the frame's container
|
|
560
|
+
(e.g. browser window). Can be used to produce screenshots of the specified size. Not supported
|
|
561
|
+
on Android.
|
|
562
|
+
|
|
563
|
+
.. deprecated::
|
|
564
|
+
:param width: Frame width (DIP).
|
|
565
|
+
:param height: Frame height (DIP).
|
|
566
|
+
"""
|
|
567
|
+
_params: Dict[str, Any] = {}
|
|
568
|
+
_params['width'] = encode(FieldMeta('', '', False, 'primitive'), width)
|
|
569
|
+
_params['height'] = encode(FieldMeta('', '', False, 'primitive'), height)
|
|
570
|
+
_result = await self._target.send('Emulation.setVisibleSize', _params)
|
|
571
|
+
return None
|
|
572
|
+
|
|
573
|
+
async def set_disabled_image_types(self, *, image_types: List[DisabledImageType]) -> None:
|
|
574
|
+
""":param image_types: Image types to disable."""
|
|
575
|
+
_params: Dict[str, Any] = {}
|
|
576
|
+
_params['imageTypes'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'enum', ref='Emulation.DisabledImageType')), image_types)
|
|
577
|
+
_result = await self._target.send('Emulation.setDisabledImageTypes', _params)
|
|
578
|
+
return None
|
|
579
|
+
|
|
580
|
+
async def set_data_saver_override(self, *, data_saver_enabled: Optional[bool] = None) -> None:
|
|
581
|
+
"""
|
|
582
|
+
Override the value of navigator.connection.saveData
|
|
583
|
+
:param data_saver_enabled: Override value. Omitting the parameter disables the override.
|
|
584
|
+
"""
|
|
585
|
+
_params: Dict[str, Any] = {}
|
|
586
|
+
if data_saver_enabled is not None:
|
|
587
|
+
_params['dataSaverEnabled'] = encode(FieldMeta('', '', False, 'primitive'), data_saver_enabled)
|
|
588
|
+
_result = await self._target.send('Emulation.setDataSaverOverride', _params)
|
|
589
|
+
return None
|
|
590
|
+
|
|
591
|
+
async def set_hardware_concurrency_override(self, *, hardware_concurrency: int) -> None:
|
|
592
|
+
""":param hardware_concurrency: Hardware concurrency to report"""
|
|
593
|
+
_params: Dict[str, Any] = {}
|
|
594
|
+
_params['hardwareConcurrency'] = encode(FieldMeta('', '', False, 'primitive'), hardware_concurrency)
|
|
595
|
+
_result = await self._target.send('Emulation.setHardwareConcurrencyOverride', _params)
|
|
596
|
+
return None
|
|
597
|
+
|
|
598
|
+
async def set_user_agent_override(self, *, user_agent: str, accept_language: Optional[str] = None, platform: Optional[str] = None, user_agent_metadata: Optional[UserAgentMetadata] = None) -> None:
|
|
599
|
+
"""
|
|
600
|
+
Allows overriding user agent with the given string.
|
|
601
|
+
`userAgentMetadata` must be set for Client Hint headers to be sent.
|
|
602
|
+
:param user_agent: User agent to use.
|
|
603
|
+
:param accept_language: Browser language to emulate.
|
|
604
|
+
:param platform: The platform navigator.platform should return.
|
|
605
|
+
:param user_agent_metadata: To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
|
|
606
|
+
"""
|
|
607
|
+
_params: Dict[str, Any] = {}
|
|
608
|
+
_params['userAgent'] = encode(FieldMeta('', '', False, 'primitive'), user_agent)
|
|
609
|
+
if accept_language is not None:
|
|
610
|
+
_params['acceptLanguage'] = encode(FieldMeta('', '', False, 'primitive'), accept_language)
|
|
611
|
+
if platform is not None:
|
|
612
|
+
_params['platform'] = encode(FieldMeta('', '', False, 'primitive'), platform)
|
|
613
|
+
if user_agent_metadata is not None:
|
|
614
|
+
_params['userAgentMetadata'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.UserAgentMetadata'), user_agent_metadata)
|
|
615
|
+
_result = await self._target.send('Emulation.setUserAgentOverride', _params)
|
|
616
|
+
return None
|
|
617
|
+
|
|
618
|
+
async def set_automation_override(self, *, enabled: bool) -> None:
|
|
619
|
+
"""
|
|
620
|
+
Allows overriding the automation flag.
|
|
621
|
+
:param enabled: Whether the override should be enabled.
|
|
622
|
+
"""
|
|
623
|
+
_params: Dict[str, Any] = {}
|
|
624
|
+
_params['enabled'] = encode(FieldMeta('', '', False, 'primitive'), enabled)
|
|
625
|
+
_result = await self._target.send('Emulation.setAutomationOverride', _params)
|
|
626
|
+
return None
|
|
627
|
+
|
|
628
|
+
async def set_small_viewport_height_difference_override(self, *, difference: int) -> None:
|
|
629
|
+
"""
|
|
630
|
+
Allows overriding the difference between the small and large viewport sizes, which determine the
|
|
631
|
+
value of the `svh` and `lvh` unit, respectively. Only supported for top-level frames.
|
|
632
|
+
:param difference: This will cause an element of size 100svh to be `difference` pixels smaller than an element
|
|
633
|
+
of size 100lvh.
|
|
634
|
+
"""
|
|
635
|
+
_params: Dict[str, Any] = {}
|
|
636
|
+
_params['difference'] = encode(FieldMeta('', '', False, 'primitive'), difference)
|
|
637
|
+
_result = await self._target.send('Emulation.setSmallViewportHeightDifferenceOverride', _params)
|
|
638
|
+
return None
|
|
639
|
+
|
|
640
|
+
async def get_screen_infos(self) -> GetScreenInfosReturn:
|
|
641
|
+
"""Returns device's screen configuration."""
|
|
642
|
+
_params: Dict[str, Any] = {}
|
|
643
|
+
_result = await self._target.send('Emulation.getScreenInfos', _params)
|
|
644
|
+
return GetScreenInfosReturn.from_json(_result)
|
|
645
|
+
|
|
646
|
+
async def add_screen(self, *, left: int, top: int, width: int, height: int, work_area_insets: Optional[WorkAreaInsets] = None, device_pixel_ratio: Optional[float] = None, rotation: Optional[int] = None, color_depth: Optional[int] = None, label: Optional[str] = None, is_internal: Optional[bool] = None) -> AddScreenReturn:
|
|
647
|
+
"""
|
|
648
|
+
Add a new screen to the device. Only supported in headless mode.
|
|
649
|
+
:param left: Offset of the left edge of the screen in pixels.
|
|
650
|
+
:param top: Offset of the top edge of the screen in pixels.
|
|
651
|
+
:param width: The width of the screen in pixels.
|
|
652
|
+
:param height: The height of the screen in pixels.
|
|
653
|
+
:param work_area_insets: Specifies the screen's work area. Default is entire screen.
|
|
654
|
+
:param device_pixel_ratio: Specifies the screen's device pixel ratio. Default is 1.
|
|
655
|
+
:param rotation: Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
|
|
656
|
+
:param color_depth: Specifies the screen's color depth in bits. Default is 24.
|
|
657
|
+
:param label: Specifies the descriptive label for the screen. Default is none.
|
|
658
|
+
:param is_internal: Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
|
|
659
|
+
"""
|
|
660
|
+
_params: Dict[str, Any] = {}
|
|
661
|
+
_params['left'] = encode(FieldMeta('', '', False, 'primitive'), left)
|
|
662
|
+
_params['top'] = encode(FieldMeta('', '', False, 'primitive'), top)
|
|
663
|
+
_params['width'] = encode(FieldMeta('', '', False, 'primitive'), width)
|
|
664
|
+
_params['height'] = encode(FieldMeta('', '', False, 'primitive'), height)
|
|
665
|
+
if work_area_insets is not None:
|
|
666
|
+
_params['workAreaInsets'] = encode(FieldMeta('', '', False, 'object', ref='Emulation.WorkAreaInsets'), work_area_insets)
|
|
667
|
+
if device_pixel_ratio is not None:
|
|
668
|
+
_params['devicePixelRatio'] = encode(FieldMeta('', '', False, 'primitive'), device_pixel_ratio)
|
|
669
|
+
if rotation is not None:
|
|
670
|
+
_params['rotation'] = encode(FieldMeta('', '', False, 'primitive'), rotation)
|
|
671
|
+
if color_depth is not None:
|
|
672
|
+
_params['colorDepth'] = encode(FieldMeta('', '', False, 'primitive'), color_depth)
|
|
673
|
+
if label is not None:
|
|
674
|
+
_params['label'] = encode(FieldMeta('', '', False, 'primitive'), label)
|
|
675
|
+
if is_internal is not None:
|
|
676
|
+
_params['isInternal'] = encode(FieldMeta('', '', False, 'primitive'), is_internal)
|
|
677
|
+
_result = await self._target.send('Emulation.addScreen', _params)
|
|
678
|
+
return AddScreenReturn.from_json(_result)
|
|
679
|
+
|
|
680
|
+
async def remove_screen(self, *, screen_id: ScreenId) -> None:
|
|
681
|
+
"""
|
|
682
|
+
Remove screen from the device. Only supported in headless mode.
|
|
683
|
+
:param screen_id:
|
|
684
|
+
"""
|
|
685
|
+
_params: Dict[str, Any] = {}
|
|
686
|
+
_params['screenId'] = encode(FieldMeta('', '', False, 'primitive'), screen_id)
|
|
687
|
+
_result = await self._target.send('Emulation.removeScreen', _params)
|
|
688
|
+
return None
|