mithwire 0.50.3__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 (76) hide show
  1. mithwire/__init__.py +32 -0
  2. mithwire/cdp/README.md +4 -0
  3. mithwire/cdp/__init__.py +6 -0
  4. mithwire/cdp/accessibility.py +668 -0
  5. mithwire/cdp/animation.py +494 -0
  6. mithwire/cdp/audits.py +1995 -0
  7. mithwire/cdp/autofill.py +292 -0
  8. mithwire/cdp/background_service.py +215 -0
  9. mithwire/cdp/bluetooth_emulation.py +626 -0
  10. mithwire/cdp/browser.py +821 -0
  11. mithwire/cdp/cache_storage.py +311 -0
  12. mithwire/cdp/cast.py +172 -0
  13. mithwire/cdp/console.py +107 -0
  14. mithwire/cdp/crash_report_context.py +55 -0
  15. mithwire/cdp/css.py +2750 -0
  16. mithwire/cdp/database.py +179 -0
  17. mithwire/cdp/debugger.py +1405 -0
  18. mithwire/cdp/device_access.py +141 -0
  19. mithwire/cdp/device_orientation.py +45 -0
  20. mithwire/cdp/dom.py +2257 -0
  21. mithwire/cdp/dom_debugger.py +321 -0
  22. mithwire/cdp/dom_snapshot.py +876 -0
  23. mithwire/cdp/dom_storage.py +222 -0
  24. mithwire/cdp/emulation.py +1779 -0
  25. mithwire/cdp/event_breakpoints.py +56 -0
  26. mithwire/cdp/extensions.py +238 -0
  27. mithwire/cdp/fed_cm.py +283 -0
  28. mithwire/cdp/fetch.py +507 -0
  29. mithwire/cdp/file_system.py +115 -0
  30. mithwire/cdp/headless_experimental.py +115 -0
  31. mithwire/cdp/heap_profiler.py +401 -0
  32. mithwire/cdp/indexed_db.py +528 -0
  33. mithwire/cdp/input_.py +701 -0
  34. mithwire/cdp/inspector.py +95 -0
  35. mithwire/cdp/io.py +101 -0
  36. mithwire/cdp/layer_tree.py +464 -0
  37. mithwire/cdp/log.py +190 -0
  38. mithwire/cdp/media.py +313 -0
  39. mithwire/cdp/memory.py +305 -0
  40. mithwire/cdp/network.py +5342 -0
  41. mithwire/cdp/overlay.py +1468 -0
  42. mithwire/cdp/page.py +3972 -0
  43. mithwire/cdp/performance.py +124 -0
  44. mithwire/cdp/performance_timeline.py +200 -0
  45. mithwire/cdp/preload.py +575 -0
  46. mithwire/cdp/profiler.py +420 -0
  47. mithwire/cdp/pwa.py +278 -0
  48. mithwire/cdp/py.typed +0 -0
  49. mithwire/cdp/runtime.py +1589 -0
  50. mithwire/cdp/schema.py +50 -0
  51. mithwire/cdp/security.py +518 -0
  52. mithwire/cdp/service_worker.py +401 -0
  53. mithwire/cdp/smart_card_emulation.py +891 -0
  54. mithwire/cdp/storage.py +1573 -0
  55. mithwire/cdp/system_info.py +327 -0
  56. mithwire/cdp/target.py +829 -0
  57. mithwire/cdp/tethering.py +65 -0
  58. mithwire/cdp/tracing.py +377 -0
  59. mithwire/cdp/util.py +18 -0
  60. mithwire/cdp/web_audio.py +606 -0
  61. mithwire/cdp/web_authn.py +598 -0
  62. mithwire/cdp/web_mcp.py +293 -0
  63. mithwire/core/_contradict.py +142 -0
  64. mithwire/core/browser.py +923 -0
  65. mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
  66. mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
  67. mithwire/core/config.py +323 -0
  68. mithwire/core/connection.py +564 -0
  69. mithwire/core/element.py +1205 -0
  70. mithwire/core/tab.py +2202 -0
  71. mithwire/core/util.py +5063 -0
  72. mithwire-0.50.3.dist-info/METADATA +1049 -0
  73. mithwire-0.50.3.dist-info/RECORD +76 -0
  74. mithwire-0.50.3.dist-info/WHEEL +5 -0
  75. mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
  76. mithwire-0.50.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1779 @@
1
+ # DO NOT EDIT THIS FILE!
2
+ #
3
+ # This file is generated from the CDP specification. If you need to make
4
+ # changes, edit the generator and regenerate all of the modules.
5
+ #
6
+ # CDP domain: Emulation
7
+
8
+ from __future__ import annotations
9
+ import enum
10
+ import typing
11
+ from dataclasses import dataclass
12
+ from .util import event_class, T_JSON_DICT
13
+
14
+ from . import dom
15
+ from . import network
16
+ from . import page
17
+ from deprecated.sphinx import deprecated # type: ignore
18
+
19
+
20
+ @dataclass
21
+ class SafeAreaInsets:
22
+ #: Overrides safe-area-inset-top.
23
+ top: typing.Optional[int] = None
24
+
25
+ #: Overrides safe-area-max-inset-top.
26
+ top_max: typing.Optional[int] = None
27
+
28
+ #: Overrides safe-area-inset-left.
29
+ left: typing.Optional[int] = None
30
+
31
+ #: Overrides safe-area-max-inset-left.
32
+ left_max: typing.Optional[int] = None
33
+
34
+ #: Overrides safe-area-inset-bottom.
35
+ bottom: typing.Optional[int] = None
36
+
37
+ #: Overrides safe-area-max-inset-bottom.
38
+ bottom_max: typing.Optional[int] = None
39
+
40
+ #: Overrides safe-area-inset-right.
41
+ right: typing.Optional[int] = None
42
+
43
+ #: Overrides safe-area-max-inset-right.
44
+ right_max: typing.Optional[int] = None
45
+
46
+ def to_json(self) -> T_JSON_DICT:
47
+ json: T_JSON_DICT = dict()
48
+ if self.top is not None:
49
+ json['top'] = self.top
50
+ if self.top_max is not None:
51
+ json['topMax'] = self.top_max
52
+ if self.left is not None:
53
+ json['left'] = self.left
54
+ if self.left_max is not None:
55
+ json['leftMax'] = self.left_max
56
+ if self.bottom is not None:
57
+ json['bottom'] = self.bottom
58
+ if self.bottom_max is not None:
59
+ json['bottomMax'] = self.bottom_max
60
+ if self.right is not None:
61
+ json['right'] = self.right
62
+ if self.right_max is not None:
63
+ json['rightMax'] = self.right_max
64
+ return json
65
+
66
+ @classmethod
67
+ def from_json(cls, json: T_JSON_DICT) -> SafeAreaInsets:
68
+ return cls(
69
+ top=int(json['top']) if json.get('top', None) is not None else None,
70
+ top_max=int(json['topMax']) if json.get('topMax', None) is not None else None,
71
+ left=int(json['left']) if json.get('left', None) is not None else None,
72
+ left_max=int(json['leftMax']) if json.get('leftMax', None) is not None else None,
73
+ bottom=int(json['bottom']) if json.get('bottom', None) is not None else None,
74
+ bottom_max=int(json['bottomMax']) if json.get('bottomMax', None) is not None else None,
75
+ right=int(json['right']) if json.get('right', None) is not None else None,
76
+ right_max=int(json['rightMax']) if json.get('rightMax', None) is not None else None,
77
+ )
78
+
79
+
80
+ @dataclass
81
+ class ScreenOrientation:
82
+ '''
83
+ Screen orientation.
84
+ '''
85
+ #: Orientation type.
86
+ type_: str
87
+
88
+ #: Orientation angle.
89
+ angle: int
90
+
91
+ def to_json(self) -> T_JSON_DICT:
92
+ json: T_JSON_DICT = dict()
93
+ json['type'] = self.type_
94
+ json['angle'] = self.angle
95
+ return json
96
+
97
+ @classmethod
98
+ def from_json(cls, json: T_JSON_DICT) -> ScreenOrientation:
99
+ return cls(
100
+ type_=str(json['type']),
101
+ angle=int(json['angle']),
102
+ )
103
+
104
+
105
+ @dataclass
106
+ class DisplayFeature:
107
+ #: Orientation of a display feature in relation to screen
108
+ orientation: str
109
+
110
+ #: The offset from the screen origin in either the x (for vertical
111
+ #: orientation) or y (for horizontal orientation) direction.
112
+ offset: int
113
+
114
+ #: A display feature may mask content such that it is not physically
115
+ #: displayed - this length along with the offset describes this area.
116
+ #: A display feature that only splits content will have a 0 mask_length.
117
+ mask_length: int
118
+
119
+ def to_json(self) -> T_JSON_DICT:
120
+ json: T_JSON_DICT = dict()
121
+ json['orientation'] = self.orientation
122
+ json['offset'] = self.offset
123
+ json['maskLength'] = self.mask_length
124
+ return json
125
+
126
+ @classmethod
127
+ def from_json(cls, json: T_JSON_DICT) -> DisplayFeature:
128
+ return cls(
129
+ orientation=str(json['orientation']),
130
+ offset=int(json['offset']),
131
+ mask_length=int(json['maskLength']),
132
+ )
133
+
134
+
135
+ @dataclass
136
+ class DevicePosture:
137
+ #: Current posture of the device
138
+ type_: str
139
+
140
+ def to_json(self) -> T_JSON_DICT:
141
+ json: T_JSON_DICT = dict()
142
+ json['type'] = self.type_
143
+ return json
144
+
145
+ @classmethod
146
+ def from_json(cls, json: T_JSON_DICT) -> DevicePosture:
147
+ return cls(
148
+ type_=str(json['type']),
149
+ )
150
+
151
+
152
+ @dataclass
153
+ class MediaFeature:
154
+ name: str
155
+
156
+ value: str
157
+
158
+ def to_json(self) -> T_JSON_DICT:
159
+ json: T_JSON_DICT = dict()
160
+ json['name'] = self.name
161
+ json['value'] = self.value
162
+ return json
163
+
164
+ @classmethod
165
+ def from_json(cls, json: T_JSON_DICT) -> MediaFeature:
166
+ return cls(
167
+ name=str(json['name']),
168
+ value=str(json['value']),
169
+ )
170
+
171
+
172
+ class VirtualTimePolicy(enum.Enum):
173
+ '''
174
+ advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to
175
+ allow the next delayed task (if any) to run; pause: The virtual time base may not advance;
176
+ pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending
177
+ resource fetches.
178
+ '''
179
+ ADVANCE = "advance"
180
+ PAUSE = "pause"
181
+ PAUSE_IF_NETWORK_FETCHES_PENDING = "pauseIfNetworkFetchesPending"
182
+
183
+ def to_json(self) -> str:
184
+ return self.value
185
+
186
+ @classmethod
187
+ def from_json(cls, json: str) -> VirtualTimePolicy:
188
+ return cls(json)
189
+
190
+
191
+ @dataclass
192
+ class UserAgentBrandVersion:
193
+ '''
194
+ Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
195
+ '''
196
+ brand: str
197
+
198
+ version: str
199
+
200
+ def to_json(self) -> T_JSON_DICT:
201
+ json: T_JSON_DICT = dict()
202
+ json['brand'] = self.brand
203
+ json['version'] = self.version
204
+ return json
205
+
206
+ @classmethod
207
+ def from_json(cls, json: T_JSON_DICT) -> UserAgentBrandVersion:
208
+ return cls(
209
+ brand=str(json['brand']),
210
+ version=str(json['version']),
211
+ )
212
+
213
+
214
+ @dataclass
215
+ class UserAgentMetadata:
216
+ '''
217
+ Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
218
+ Missing optional values will be filled in by the target with what it would normally use.
219
+ '''
220
+ platform: str
221
+
222
+ platform_version: str
223
+
224
+ architecture: str
225
+
226
+ model: str
227
+
228
+ mobile: bool
229
+
230
+ #: Brands appearing in Sec-CH-UA.
231
+ brands: typing.Optional[typing.List[UserAgentBrandVersion]] = None
232
+
233
+ #: Brands appearing in Sec-CH-UA-Full-Version-List.
234
+ full_version_list: typing.Optional[typing.List[UserAgentBrandVersion]] = None
235
+
236
+ full_version: typing.Optional[str] = None
237
+
238
+ bitness: typing.Optional[str] = None
239
+
240
+ wow64: typing.Optional[bool] = None
241
+
242
+ #: Used to specify User Agent form-factor values.
243
+ #: See https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors
244
+ form_factors: typing.Optional[typing.List[str]] = None
245
+
246
+ def to_json(self) -> T_JSON_DICT:
247
+ json: T_JSON_DICT = dict()
248
+ json['platform'] = self.platform
249
+ json['platformVersion'] = self.platform_version
250
+ json['architecture'] = self.architecture
251
+ json['model'] = self.model
252
+ json['mobile'] = self.mobile
253
+ if self.brands is not None:
254
+ json['brands'] = [i.to_json() for i in self.brands]
255
+ if self.full_version_list is not None:
256
+ json['fullVersionList'] = [i.to_json() for i in self.full_version_list]
257
+ if self.full_version is not None:
258
+ json['fullVersion'] = self.full_version
259
+ if self.bitness is not None:
260
+ json['bitness'] = self.bitness
261
+ if self.wow64 is not None:
262
+ json['wow64'] = self.wow64
263
+ if self.form_factors is not None:
264
+ json['formFactors'] = [i for i in self.form_factors]
265
+ return json
266
+
267
+ @classmethod
268
+ def from_json(cls, json: T_JSON_DICT) -> UserAgentMetadata:
269
+ return cls(
270
+ platform=str(json['platform']),
271
+ platform_version=str(json['platformVersion']),
272
+ architecture=str(json['architecture']),
273
+ model=str(json['model']),
274
+ mobile=bool(json['mobile']),
275
+ brands=[UserAgentBrandVersion.from_json(i) for i in json['brands']] if json.get('brands', None) is not None else None,
276
+ full_version_list=[UserAgentBrandVersion.from_json(i) for i in json['fullVersionList']] if json.get('fullVersionList', None) is not None else None,
277
+ full_version=str(json['fullVersion']) if json.get('fullVersion', None) is not None else None,
278
+ bitness=str(json['bitness']) if json.get('bitness', None) is not None else None,
279
+ wow64=bool(json['wow64']) if json.get('wow64', None) is not None else None,
280
+ form_factors=[str(i) for i in json['formFactors']] if json.get('formFactors', None) is not None else None,
281
+ )
282
+
283
+
284
+ class SensorType(enum.Enum):
285
+ '''
286
+ Used to specify sensor types to emulate.
287
+ See https://w3c.github.io/sensors/#automation for more information.
288
+ '''
289
+ ABSOLUTE_ORIENTATION = "absolute-orientation"
290
+ ACCELEROMETER = "accelerometer"
291
+ AMBIENT_LIGHT = "ambient-light"
292
+ GRAVITY = "gravity"
293
+ GYROSCOPE = "gyroscope"
294
+ LINEAR_ACCELERATION = "linear-acceleration"
295
+ MAGNETOMETER = "magnetometer"
296
+ RELATIVE_ORIENTATION = "relative-orientation"
297
+
298
+ def to_json(self) -> str:
299
+ return self.value
300
+
301
+ @classmethod
302
+ def from_json(cls, json: str) -> SensorType:
303
+ return cls(json)
304
+
305
+
306
+ @dataclass
307
+ class SensorMetadata:
308
+ available: typing.Optional[bool] = None
309
+
310
+ minimum_frequency: typing.Optional[float] = None
311
+
312
+ maximum_frequency: typing.Optional[float] = None
313
+
314
+ def to_json(self) -> T_JSON_DICT:
315
+ json: T_JSON_DICT = dict()
316
+ if self.available is not None:
317
+ json['available'] = self.available
318
+ if self.minimum_frequency is not None:
319
+ json['minimumFrequency'] = self.minimum_frequency
320
+ if self.maximum_frequency is not None:
321
+ json['maximumFrequency'] = self.maximum_frequency
322
+ return json
323
+
324
+ @classmethod
325
+ def from_json(cls, json: T_JSON_DICT) -> SensorMetadata:
326
+ return cls(
327
+ available=bool(json['available']) if json.get('available', None) is not None else None,
328
+ minimum_frequency=float(json['minimumFrequency']) if json.get('minimumFrequency', None) is not None else None,
329
+ maximum_frequency=float(json['maximumFrequency']) if json.get('maximumFrequency', None) is not None else None,
330
+ )
331
+
332
+
333
+ @dataclass
334
+ class SensorReadingSingle:
335
+ value: float
336
+
337
+ def to_json(self) -> T_JSON_DICT:
338
+ json: T_JSON_DICT = dict()
339
+ json['value'] = self.value
340
+ return json
341
+
342
+ @classmethod
343
+ def from_json(cls, json: T_JSON_DICT) -> SensorReadingSingle:
344
+ return cls(
345
+ value=float(json['value']),
346
+ )
347
+
348
+
349
+ @dataclass
350
+ class SensorReadingXYZ:
351
+ x: float
352
+
353
+ y: float
354
+
355
+ z: float
356
+
357
+ def to_json(self) -> T_JSON_DICT:
358
+ json: T_JSON_DICT = dict()
359
+ json['x'] = self.x
360
+ json['y'] = self.y
361
+ json['z'] = self.z
362
+ return json
363
+
364
+ @classmethod
365
+ def from_json(cls, json: T_JSON_DICT) -> SensorReadingXYZ:
366
+ return cls(
367
+ x=float(json['x']),
368
+ y=float(json['y']),
369
+ z=float(json['z']),
370
+ )
371
+
372
+
373
+ @dataclass
374
+ class SensorReadingQuaternion:
375
+ x: float
376
+
377
+ y: float
378
+
379
+ z: float
380
+
381
+ w: float
382
+
383
+ def to_json(self) -> T_JSON_DICT:
384
+ json: T_JSON_DICT = dict()
385
+ json['x'] = self.x
386
+ json['y'] = self.y
387
+ json['z'] = self.z
388
+ json['w'] = self.w
389
+ return json
390
+
391
+ @classmethod
392
+ def from_json(cls, json: T_JSON_DICT) -> SensorReadingQuaternion:
393
+ return cls(
394
+ x=float(json['x']),
395
+ y=float(json['y']),
396
+ z=float(json['z']),
397
+ w=float(json['w']),
398
+ )
399
+
400
+
401
+ @dataclass
402
+ class SensorReading:
403
+ single: typing.Optional[SensorReadingSingle] = None
404
+
405
+ xyz: typing.Optional[SensorReadingXYZ] = None
406
+
407
+ quaternion: typing.Optional[SensorReadingQuaternion] = None
408
+
409
+ def to_json(self) -> T_JSON_DICT:
410
+ json: T_JSON_DICT = dict()
411
+ if self.single is not None:
412
+ json['single'] = self.single.to_json()
413
+ if self.xyz is not None:
414
+ json['xyz'] = self.xyz.to_json()
415
+ if self.quaternion is not None:
416
+ json['quaternion'] = self.quaternion.to_json()
417
+ return json
418
+
419
+ @classmethod
420
+ def from_json(cls, json: T_JSON_DICT) -> SensorReading:
421
+ return cls(
422
+ single=SensorReadingSingle.from_json(json['single']) if json.get('single', None) is not None else None,
423
+ xyz=SensorReadingXYZ.from_json(json['xyz']) if json.get('xyz', None) is not None else None,
424
+ quaternion=SensorReadingQuaternion.from_json(json['quaternion']) if json.get('quaternion', None) is not None else None,
425
+ )
426
+
427
+
428
+ class PressureSource(enum.Enum):
429
+ CPU = "cpu"
430
+
431
+ def to_json(self) -> str:
432
+ return self.value
433
+
434
+ @classmethod
435
+ def from_json(cls, json: str) -> PressureSource:
436
+ return cls(json)
437
+
438
+
439
+ class PressureState(enum.Enum):
440
+ NOMINAL = "nominal"
441
+ FAIR = "fair"
442
+ SERIOUS = "serious"
443
+ CRITICAL = "critical"
444
+
445
+ def to_json(self) -> str:
446
+ return self.value
447
+
448
+ @classmethod
449
+ def from_json(cls, json: str) -> PressureState:
450
+ return cls(json)
451
+
452
+
453
+ @dataclass
454
+ class PressureMetadata:
455
+ available: typing.Optional[bool] = None
456
+
457
+ def to_json(self) -> T_JSON_DICT:
458
+ json: T_JSON_DICT = dict()
459
+ if self.available is not None:
460
+ json['available'] = self.available
461
+ return json
462
+
463
+ @classmethod
464
+ def from_json(cls, json: T_JSON_DICT) -> PressureMetadata:
465
+ return cls(
466
+ available=bool(json['available']) if json.get('available', None) is not None else None,
467
+ )
468
+
469
+
470
+ @dataclass
471
+ class WorkAreaInsets:
472
+ #: Work area top inset in pixels. Default is 0;
473
+ top: typing.Optional[int] = None
474
+
475
+ #: Work area left inset in pixels. Default is 0;
476
+ left: typing.Optional[int] = None
477
+
478
+ #: Work area bottom inset in pixels. Default is 0;
479
+ bottom: typing.Optional[int] = None
480
+
481
+ #: Work area right inset in pixels. Default is 0;
482
+ right: typing.Optional[int] = None
483
+
484
+ def to_json(self) -> T_JSON_DICT:
485
+ json: T_JSON_DICT = dict()
486
+ if self.top is not None:
487
+ json['top'] = self.top
488
+ if self.left is not None:
489
+ json['left'] = self.left
490
+ if self.bottom is not None:
491
+ json['bottom'] = self.bottom
492
+ if self.right is not None:
493
+ json['right'] = self.right
494
+ return json
495
+
496
+ @classmethod
497
+ def from_json(cls, json: T_JSON_DICT) -> WorkAreaInsets:
498
+ return cls(
499
+ top=int(json['top']) if json.get('top', None) is not None else None,
500
+ left=int(json['left']) if json.get('left', None) is not None else None,
501
+ bottom=int(json['bottom']) if json.get('bottom', None) is not None else None,
502
+ right=int(json['right']) if json.get('right', None) is not None else None,
503
+ )
504
+
505
+
506
+ class ScreenId(str):
507
+ def to_json(self) -> str:
508
+ return self
509
+
510
+ @classmethod
511
+ def from_json(cls, json: str) -> ScreenId:
512
+ return cls(json)
513
+
514
+ def __repr__(self):
515
+ return 'ScreenId({})'.format(super().__repr__())
516
+
517
+
518
+ @dataclass
519
+ class ScreenInfo:
520
+ '''
521
+ Screen information similar to the one returned by window.getScreenDetails() method,
522
+ see https://w3c.github.io/window-management/#screendetailed.
523
+ '''
524
+ #: Offset of the left edge of the screen.
525
+ left: int
526
+
527
+ #: Offset of the top edge of the screen.
528
+ top: int
529
+
530
+ #: Width of the screen.
531
+ width: int
532
+
533
+ #: Height of the screen.
534
+ height: int
535
+
536
+ #: Offset of the left edge of the available screen area.
537
+ avail_left: int
538
+
539
+ #: Offset of the top edge of the available screen area.
540
+ avail_top: int
541
+
542
+ #: Width of the available screen area.
543
+ avail_width: int
544
+
545
+ #: Height of the available screen area.
546
+ avail_height: int
547
+
548
+ #: Specifies the screen's device pixel ratio.
549
+ device_pixel_ratio: float
550
+
551
+ #: Specifies the screen's orientation.
552
+ orientation: ScreenOrientation
553
+
554
+ #: Specifies the screen's color depth in bits.
555
+ color_depth: int
556
+
557
+ #: Indicates whether the device has multiple screens.
558
+ is_extended: bool
559
+
560
+ #: Indicates whether the screen is internal to the device or external, attached to the device.
561
+ is_internal: bool
562
+
563
+ #: Indicates whether the screen is set as the the operating system primary screen.
564
+ is_primary: bool
565
+
566
+ #: Specifies the descriptive label for the screen.
567
+ label: str
568
+
569
+ #: Specifies the unique identifier of the screen.
570
+ id_: ScreenId
571
+
572
+ def to_json(self) -> T_JSON_DICT:
573
+ json: T_JSON_DICT = dict()
574
+ json['left'] = self.left
575
+ json['top'] = self.top
576
+ json['width'] = self.width
577
+ json['height'] = self.height
578
+ json['availLeft'] = self.avail_left
579
+ json['availTop'] = self.avail_top
580
+ json['availWidth'] = self.avail_width
581
+ json['availHeight'] = self.avail_height
582
+ json['devicePixelRatio'] = self.device_pixel_ratio
583
+ json['orientation'] = self.orientation.to_json()
584
+ json['colorDepth'] = self.color_depth
585
+ json['isExtended'] = self.is_extended
586
+ json['isInternal'] = self.is_internal
587
+ json['isPrimary'] = self.is_primary
588
+ json['label'] = self.label
589
+ json['id'] = self.id_.to_json()
590
+ return json
591
+
592
+ @classmethod
593
+ def from_json(cls, json: T_JSON_DICT) -> ScreenInfo:
594
+ return cls(
595
+ left=int(json['left']),
596
+ top=int(json['top']),
597
+ width=int(json['width']),
598
+ height=int(json['height']),
599
+ avail_left=int(json['availLeft']),
600
+ avail_top=int(json['availTop']),
601
+ avail_width=int(json['availWidth']),
602
+ avail_height=int(json['availHeight']),
603
+ device_pixel_ratio=float(json['devicePixelRatio']),
604
+ orientation=ScreenOrientation.from_json(json['orientation']),
605
+ color_depth=int(json['colorDepth']),
606
+ is_extended=bool(json['isExtended']),
607
+ is_internal=bool(json['isInternal']),
608
+ is_primary=bool(json['isPrimary']),
609
+ label=str(json['label']),
610
+ id_=ScreenId.from_json(json['id']),
611
+ )
612
+
613
+
614
+ class DisabledImageType(enum.Enum):
615
+ '''
616
+ Enum of image types that can be disabled.
617
+ '''
618
+ AVIF = "avif"
619
+ JXL = "jxl"
620
+ WEBP = "webp"
621
+
622
+ def to_json(self) -> str:
623
+ return self.value
624
+
625
+ @classmethod
626
+ def from_json(cls, json: str) -> DisabledImageType:
627
+ return cls(json)
628
+
629
+
630
+ @deprecated(version="1.3")
631
+ def can_emulate() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]:
632
+ '''
633
+ Tells whether emulation is supported.
634
+
635
+ .. deprecated:: 1.3
636
+
637
+ :returns: True if emulation is supported.
638
+ '''
639
+ cmd_dict: T_JSON_DICT = {
640
+ 'method': 'Emulation.canEmulate',
641
+ }
642
+ json = yield cmd_dict
643
+ return bool(json['result'])
644
+
645
+
646
+ def clear_device_metrics_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
647
+ '''
648
+ Clears the overridden device metrics.
649
+ '''
650
+ cmd_dict: T_JSON_DICT = {
651
+ 'method': 'Emulation.clearDeviceMetricsOverride',
652
+ }
653
+ json = yield cmd_dict
654
+
655
+
656
+ def clear_geolocation_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
657
+ '''
658
+ Clears the overridden Geolocation Position and Error.
659
+ '''
660
+ cmd_dict: T_JSON_DICT = {
661
+ 'method': 'Emulation.clearGeolocationOverride',
662
+ }
663
+ json = yield cmd_dict
664
+
665
+
666
+ def reset_page_scale_factor() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
667
+ '''
668
+ Requests that page scale factor is reset to initial values.
669
+
670
+ **EXPERIMENTAL**
671
+ '''
672
+ cmd_dict: T_JSON_DICT = {
673
+ 'method': 'Emulation.resetPageScaleFactor',
674
+ }
675
+ json = yield cmd_dict
676
+
677
+
678
+ def set_focus_emulation_enabled(
679
+ enabled: bool
680
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
681
+ '''
682
+ Enables or disables simulating a focused and active page.
683
+
684
+ **EXPERIMENTAL**
685
+
686
+ :param enabled: Whether to enable to disable focus emulation.
687
+ '''
688
+ params: T_JSON_DICT = dict()
689
+ params['enabled'] = enabled
690
+ cmd_dict: T_JSON_DICT = {
691
+ 'method': 'Emulation.setFocusEmulationEnabled',
692
+ 'params': params,
693
+ }
694
+ json = yield cmd_dict
695
+
696
+
697
+ def set_auto_dark_mode_override(
698
+ enabled: typing.Optional[bool] = None
699
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
700
+ '''
701
+ Automatically render all web contents using a dark theme.
702
+
703
+ **EXPERIMENTAL**
704
+
705
+ :param enabled: *(Optional)* Whether to enable or disable automatic dark mode. If not specified, any existing override will be cleared.
706
+ '''
707
+ params: T_JSON_DICT = dict()
708
+ if enabled is not None:
709
+ params['enabled'] = enabled
710
+ cmd_dict: T_JSON_DICT = {
711
+ 'method': 'Emulation.setAutoDarkModeOverride',
712
+ 'params': params,
713
+ }
714
+ json = yield cmd_dict
715
+
716
+
717
+ def set_cpu_throttling_rate(
718
+ rate: float
719
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
720
+ '''
721
+ Enables CPU throttling to emulate slow CPUs.
722
+
723
+ :param rate: Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
724
+ '''
725
+ params: T_JSON_DICT = dict()
726
+ params['rate'] = rate
727
+ cmd_dict: T_JSON_DICT = {
728
+ 'method': 'Emulation.setCPUThrottlingRate',
729
+ 'params': params,
730
+ }
731
+ json = yield cmd_dict
732
+
733
+
734
+ def set_default_background_color_override(
735
+ color: typing.Optional[dom.RGBA] = None
736
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
737
+ '''
738
+ Sets or clears an override of the default background color of the frame. This override is used
739
+ if the content does not specify one.
740
+
741
+ :param color: *(Optional)* RGBA of the default background color. If not specified, any existing override will be cleared.
742
+ '''
743
+ params: T_JSON_DICT = dict()
744
+ if color is not None:
745
+ params['color'] = color.to_json()
746
+ cmd_dict: T_JSON_DICT = {
747
+ 'method': 'Emulation.setDefaultBackgroundColorOverride',
748
+ 'params': params,
749
+ }
750
+ json = yield cmd_dict
751
+
752
+
753
+ def set_safe_area_insets_override(
754
+ insets: SafeAreaInsets
755
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
756
+ '''
757
+ Overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the
758
+ respective variables to be undefined, even if previously overridden.
759
+
760
+ **EXPERIMENTAL**
761
+
762
+ :param insets:
763
+ '''
764
+ params: T_JSON_DICT = dict()
765
+ params['insets'] = insets.to_json()
766
+ cmd_dict: T_JSON_DICT = {
767
+ 'method': 'Emulation.setSafeAreaInsetsOverride',
768
+ 'params': params,
769
+ }
770
+ json = yield cmd_dict
771
+
772
+
773
+ def set_device_metrics_override(
774
+ width: int,
775
+ height: int,
776
+ device_scale_factor: float,
777
+ mobile: bool,
778
+ scale: typing.Optional[float] = None,
779
+ screen_width: typing.Optional[int] = None,
780
+ screen_height: typing.Optional[int] = None,
781
+ position_x: typing.Optional[int] = None,
782
+ position_y: typing.Optional[int] = None,
783
+ dont_set_visible_size: typing.Optional[bool] = None,
784
+ screen_orientation: typing.Optional[ScreenOrientation] = None,
785
+ viewport: typing.Optional[page.Viewport] = None,
786
+ display_feature: typing.Optional[DisplayFeature] = None,
787
+ device_posture: typing.Optional[DevicePosture] = None,
788
+ scrollbar_type: typing.Optional[str] = None,
789
+ screen_orientation_lock_emulation: typing.Optional[bool] = None
790
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
791
+ '''
792
+ Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
793
+ window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
794
+ query results).
795
+
796
+ :param width: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
797
+ :param height: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
798
+ :param device_scale_factor: Overriding device scale factor value. 0 disables the override.
799
+ :param mobile: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
800
+ :param scale: **(EXPERIMENTAL)** *(Optional)* Scale to apply to resulting view image.
801
+ :param screen_width: **(EXPERIMENTAL)** *(Optional)* Overriding screen width value in pixels (minimum 0, maximum 10000000).
802
+ :param screen_height: **(EXPERIMENTAL)** *(Optional)* Overriding screen height value in pixels (minimum 0, maximum 10000000).
803
+ :param position_x: **(EXPERIMENTAL)** *(Optional)* Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
804
+ :param position_y: **(EXPERIMENTAL)** *(Optional)* Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
805
+ :param dont_set_visible_size: **(EXPERIMENTAL)** *(Optional)* Do not set visible view size, rely upon explicit setVisibleSize call.
806
+ :param screen_orientation: *(Optional)* Screen orientation override.
807
+ :param viewport: **(EXPERIMENTAL)** *(Optional)* If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
808
+ :param display_feature: **(DEPRECATED)** **(EXPERIMENTAL)** *(Optional)* If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. Deprecated, use Emulation.setDisplayFeaturesOverride.
809
+ :param device_posture: **(DEPRECATED)** **(EXPERIMENTAL)** *(Optional)* If set, the posture of a foldable device. If not set the posture is set to continuous. Deprecated, use Emulation.setDevicePostureOverride.
810
+ :param scrollbar_type: **(EXPERIMENTAL)** *(Optional)* Scrollbar type. Default: ```default```.
811
+ :param screen_orientation_lock_emulation: **(EXPERIMENTAL)** *(Optional)* If set to true, enables screen orientation lock emulation, which intercepts screen.orientation.lock() calls from the page and reports orientation changes via screenOrientationLockChanged events. This is useful for emulating mobile device orientation lock behavior in responsive design mode.
812
+ '''
813
+ params: T_JSON_DICT = dict()
814
+ params['width'] = width
815
+ params['height'] = height
816
+ params['deviceScaleFactor'] = device_scale_factor
817
+ params['mobile'] = mobile
818
+ if scale is not None:
819
+ params['scale'] = scale
820
+ if screen_width is not None:
821
+ params['screenWidth'] = screen_width
822
+ if screen_height is not None:
823
+ params['screenHeight'] = screen_height
824
+ if position_x is not None:
825
+ params['positionX'] = position_x
826
+ if position_y is not None:
827
+ params['positionY'] = position_y
828
+ if dont_set_visible_size is not None:
829
+ params['dontSetVisibleSize'] = dont_set_visible_size
830
+ if screen_orientation is not None:
831
+ params['screenOrientation'] = screen_orientation.to_json()
832
+ if viewport is not None:
833
+ params['viewport'] = viewport.to_json()
834
+ if display_feature is not None:
835
+ params['displayFeature'] = display_feature.to_json()
836
+ if device_posture is not None:
837
+ params['devicePosture'] = device_posture.to_json()
838
+ if scrollbar_type is not None:
839
+ params['scrollbarType'] = scrollbar_type
840
+ if screen_orientation_lock_emulation is not None:
841
+ params['screenOrientationLockEmulation'] = screen_orientation_lock_emulation
842
+ cmd_dict: T_JSON_DICT = {
843
+ 'method': 'Emulation.setDeviceMetricsOverride',
844
+ 'params': params,
845
+ }
846
+ json = yield cmd_dict
847
+
848
+
849
+ def set_device_posture_override(
850
+ posture: DevicePosture
851
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
852
+ '''
853
+ Start reporting the given posture value to the Device Posture API.
854
+ This override can also be set in setDeviceMetricsOverride().
855
+
856
+ **EXPERIMENTAL**
857
+
858
+ :param posture:
859
+ '''
860
+ params: T_JSON_DICT = dict()
861
+ params['posture'] = posture.to_json()
862
+ cmd_dict: T_JSON_DICT = {
863
+ 'method': 'Emulation.setDevicePostureOverride',
864
+ 'params': params,
865
+ }
866
+ json = yield cmd_dict
867
+
868
+
869
+ def clear_device_posture_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
870
+ '''
871
+ Clears a device posture override set with either setDeviceMetricsOverride()
872
+ or setDevicePostureOverride() and starts using posture information from the
873
+ platform again.
874
+ Does nothing if no override is set.
875
+
876
+ **EXPERIMENTAL**
877
+ '''
878
+ cmd_dict: T_JSON_DICT = {
879
+ 'method': 'Emulation.clearDevicePostureOverride',
880
+ }
881
+ json = yield cmd_dict
882
+
883
+
884
+ def set_display_features_override(
885
+ features: typing.List[DisplayFeature]
886
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
887
+ '''
888
+ Start using the given display features to pupulate the Viewport Segments API.
889
+ This override can also be set in setDeviceMetricsOverride().
890
+
891
+ **EXPERIMENTAL**
892
+
893
+ :param features:
894
+ '''
895
+ params: T_JSON_DICT = dict()
896
+ params['features'] = [i.to_json() for i in features]
897
+ cmd_dict: T_JSON_DICT = {
898
+ 'method': 'Emulation.setDisplayFeaturesOverride',
899
+ 'params': params,
900
+ }
901
+ json = yield cmd_dict
902
+
903
+
904
+ def clear_display_features_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
905
+ '''
906
+ Clears the display features override set with either setDeviceMetricsOverride()
907
+ or setDisplayFeaturesOverride() and starts using display features from the
908
+ platform again.
909
+ Does nothing if no override is set.
910
+
911
+ **EXPERIMENTAL**
912
+ '''
913
+ cmd_dict: T_JSON_DICT = {
914
+ 'method': 'Emulation.clearDisplayFeaturesOverride',
915
+ }
916
+ json = yield cmd_dict
917
+
918
+
919
+ def set_scrollbars_hidden(
920
+ hidden: bool
921
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
922
+ '''
923
+
924
+
925
+ **EXPERIMENTAL**
926
+
927
+ :param hidden: Whether scrollbars should be always hidden.
928
+ '''
929
+ params: T_JSON_DICT = dict()
930
+ params['hidden'] = hidden
931
+ cmd_dict: T_JSON_DICT = {
932
+ 'method': 'Emulation.setScrollbarsHidden',
933
+ 'params': params,
934
+ }
935
+ json = yield cmd_dict
936
+
937
+
938
+ def set_document_cookie_disabled(
939
+ disabled: bool
940
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
941
+ '''
942
+
943
+
944
+ **EXPERIMENTAL**
945
+
946
+ :param disabled: Whether document.coookie API should be disabled.
947
+ '''
948
+ params: T_JSON_DICT = dict()
949
+ params['disabled'] = disabled
950
+ cmd_dict: T_JSON_DICT = {
951
+ 'method': 'Emulation.setDocumentCookieDisabled',
952
+ 'params': params,
953
+ }
954
+ json = yield cmd_dict
955
+
956
+
957
+ def set_emit_touch_events_for_mouse(
958
+ enabled: bool,
959
+ configuration: typing.Optional[str] = None
960
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
961
+ '''
962
+
963
+
964
+ **EXPERIMENTAL**
965
+
966
+ :param enabled: Whether touch emulation based on mouse input should be enabled.
967
+ :param configuration: *(Optional)* Touch/gesture events configuration. Default: current platform.
968
+ '''
969
+ params: T_JSON_DICT = dict()
970
+ params['enabled'] = enabled
971
+ if configuration is not None:
972
+ params['configuration'] = configuration
973
+ cmd_dict: T_JSON_DICT = {
974
+ 'method': 'Emulation.setEmitTouchEventsForMouse',
975
+ 'params': params,
976
+ }
977
+ json = yield cmd_dict
978
+
979
+
980
+ def set_emulated_media(
981
+ media: typing.Optional[str] = None,
982
+ features: typing.Optional[typing.List[MediaFeature]] = None
983
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
984
+ '''
985
+ Emulates the given media type or media feature for CSS media queries.
986
+
987
+ :param media: *(Optional)* Media type to emulate. Empty string disables the override.
988
+ :param features: *(Optional)* Media features to emulate.
989
+ '''
990
+ params: T_JSON_DICT = dict()
991
+ if media is not None:
992
+ params['media'] = media
993
+ if features is not None:
994
+ params['features'] = [i.to_json() for i in features]
995
+ cmd_dict: T_JSON_DICT = {
996
+ 'method': 'Emulation.setEmulatedMedia',
997
+ 'params': params,
998
+ }
999
+ json = yield cmd_dict
1000
+
1001
+
1002
+ def set_emulated_vision_deficiency(
1003
+ type_: str
1004
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1005
+ '''
1006
+ Emulates the given vision deficiency.
1007
+
1008
+ :param type_: Vision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
1009
+ '''
1010
+ params: T_JSON_DICT = dict()
1011
+ params['type'] = type_
1012
+ cmd_dict: T_JSON_DICT = {
1013
+ 'method': 'Emulation.setEmulatedVisionDeficiency',
1014
+ 'params': params,
1015
+ }
1016
+ json = yield cmd_dict
1017
+
1018
+
1019
+ def set_emulated_os_text_scale(
1020
+ scale: typing.Optional[float] = None
1021
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1022
+ '''
1023
+ Emulates the given OS text scale.
1024
+
1025
+ :param scale: *(Optional)*
1026
+ '''
1027
+ params: T_JSON_DICT = dict()
1028
+ if scale is not None:
1029
+ params['scale'] = scale
1030
+ cmd_dict: T_JSON_DICT = {
1031
+ 'method': 'Emulation.setEmulatedOSTextScale',
1032
+ 'params': params,
1033
+ }
1034
+ json = yield cmd_dict
1035
+
1036
+
1037
+ def set_geolocation_override(
1038
+ latitude: typing.Optional[float] = None,
1039
+ longitude: typing.Optional[float] = None,
1040
+ accuracy: typing.Optional[float] = None,
1041
+ altitude: typing.Optional[float] = None,
1042
+ altitude_accuracy: typing.Optional[float] = None,
1043
+ heading: typing.Optional[float] = None,
1044
+ speed: typing.Optional[float] = None
1045
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1046
+ '''
1047
+ Overrides the Geolocation Position or Error. Omitting latitude, longitude or
1048
+ accuracy emulates position unavailable.
1049
+
1050
+ :param latitude: *(Optional)* Mock latitude
1051
+ :param longitude: *(Optional)* Mock longitude
1052
+ :param accuracy: *(Optional)* Mock accuracy
1053
+ :param altitude: *(Optional)* Mock altitude
1054
+ :param altitude_accuracy: *(Optional)* Mock altitudeAccuracy
1055
+ :param heading: *(Optional)* Mock heading
1056
+ :param speed: *(Optional)* Mock speed
1057
+ '''
1058
+ params: T_JSON_DICT = dict()
1059
+ if latitude is not None:
1060
+ params['latitude'] = latitude
1061
+ if longitude is not None:
1062
+ params['longitude'] = longitude
1063
+ if accuracy is not None:
1064
+ params['accuracy'] = accuracy
1065
+ if altitude is not None:
1066
+ params['altitude'] = altitude
1067
+ if altitude_accuracy is not None:
1068
+ params['altitudeAccuracy'] = altitude_accuracy
1069
+ if heading is not None:
1070
+ params['heading'] = heading
1071
+ if speed is not None:
1072
+ params['speed'] = speed
1073
+ cmd_dict: T_JSON_DICT = {
1074
+ 'method': 'Emulation.setGeolocationOverride',
1075
+ 'params': params,
1076
+ }
1077
+ json = yield cmd_dict
1078
+
1079
+
1080
+ def get_overridden_sensor_information(
1081
+ type_: SensorType
1082
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]:
1083
+ '''
1084
+
1085
+
1086
+ **EXPERIMENTAL**
1087
+
1088
+ :param type_:
1089
+ :returns:
1090
+ '''
1091
+ params: T_JSON_DICT = dict()
1092
+ params['type'] = type_.to_json()
1093
+ cmd_dict: T_JSON_DICT = {
1094
+ 'method': 'Emulation.getOverriddenSensorInformation',
1095
+ 'params': params,
1096
+ }
1097
+ json = yield cmd_dict
1098
+ return float(json['requestedSamplingFrequency'])
1099
+
1100
+
1101
+ def set_sensor_override_enabled(
1102
+ enabled: bool,
1103
+ type_: SensorType,
1104
+ metadata: typing.Optional[SensorMetadata] = None
1105
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1106
+ '''
1107
+ Overrides a platform sensor of a given type. If ``enabled`` is true, calls to
1108
+ Sensor.start() will use a virtual sensor as backend rather than fetching
1109
+ data from a real hardware sensor. Otherwise, existing virtual
1110
+ sensor-backend Sensor objects will fire an error event and new calls to
1111
+ Sensor.start() will attempt to use a real sensor instead.
1112
+
1113
+ **EXPERIMENTAL**
1114
+
1115
+ :param enabled:
1116
+ :param type_:
1117
+ :param metadata: *(Optional)*
1118
+ '''
1119
+ params: T_JSON_DICT = dict()
1120
+ params['enabled'] = enabled
1121
+ params['type'] = type_.to_json()
1122
+ if metadata is not None:
1123
+ params['metadata'] = metadata.to_json()
1124
+ cmd_dict: T_JSON_DICT = {
1125
+ 'method': 'Emulation.setSensorOverrideEnabled',
1126
+ 'params': params,
1127
+ }
1128
+ json = yield cmd_dict
1129
+
1130
+
1131
+ def set_sensor_override_readings(
1132
+ type_: SensorType,
1133
+ reading: SensorReading
1134
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1135
+ '''
1136
+ Updates the sensor readings reported by a sensor type previously overridden
1137
+ by setSensorOverrideEnabled.
1138
+
1139
+ **EXPERIMENTAL**
1140
+
1141
+ :param type_:
1142
+ :param reading:
1143
+ '''
1144
+ params: T_JSON_DICT = dict()
1145
+ params['type'] = type_.to_json()
1146
+ params['reading'] = reading.to_json()
1147
+ cmd_dict: T_JSON_DICT = {
1148
+ 'method': 'Emulation.setSensorOverrideReadings',
1149
+ 'params': params,
1150
+ }
1151
+ json = yield cmd_dict
1152
+
1153
+
1154
+ def set_pressure_source_override_enabled(
1155
+ enabled: bool,
1156
+ source: PressureSource,
1157
+ metadata: typing.Optional[PressureMetadata] = None
1158
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1159
+ '''
1160
+ Overrides a pressure source of a given type, as used by the Compute
1161
+ Pressure API, so that updates to PressureObserver.observe() are provided
1162
+ via setPressureStateOverride instead of being retrieved from
1163
+ platform-provided telemetry data.
1164
+
1165
+ **EXPERIMENTAL**
1166
+
1167
+ :param enabled:
1168
+ :param source:
1169
+ :param metadata: *(Optional)*
1170
+ '''
1171
+ params: T_JSON_DICT = dict()
1172
+ params['enabled'] = enabled
1173
+ params['source'] = source.to_json()
1174
+ if metadata is not None:
1175
+ params['metadata'] = metadata.to_json()
1176
+ cmd_dict: T_JSON_DICT = {
1177
+ 'method': 'Emulation.setPressureSourceOverrideEnabled',
1178
+ 'params': params,
1179
+ }
1180
+ json = yield cmd_dict
1181
+
1182
+
1183
+ def set_pressure_state_override(
1184
+ source: PressureSource,
1185
+ state: PressureState
1186
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1187
+ '''
1188
+ TODO: OBSOLETE: To remove when setPressureDataOverride is merged.
1189
+ Provides a given pressure state that will be processed and eventually be
1190
+ delivered to PressureObserver users. ``source`` must have been previously
1191
+ overridden by setPressureSourceOverrideEnabled.
1192
+
1193
+ **EXPERIMENTAL**
1194
+
1195
+ :param source:
1196
+ :param state:
1197
+ '''
1198
+ params: T_JSON_DICT = dict()
1199
+ params['source'] = source.to_json()
1200
+ params['state'] = state.to_json()
1201
+ cmd_dict: T_JSON_DICT = {
1202
+ 'method': 'Emulation.setPressureStateOverride',
1203
+ 'params': params,
1204
+ }
1205
+ json = yield cmd_dict
1206
+
1207
+
1208
+ def set_pressure_data_override(
1209
+ source: PressureSource,
1210
+ state: PressureState,
1211
+ own_contribution_estimate: typing.Optional[float] = None
1212
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1213
+ '''
1214
+ Provides a given pressure data set that will be processed and eventually be
1215
+ delivered to PressureObserver users. ``source`` must have been previously
1216
+ overridden by setPressureSourceOverrideEnabled.
1217
+
1218
+ **EXPERIMENTAL**
1219
+
1220
+ :param source:
1221
+ :param state:
1222
+ :param own_contribution_estimate: *(Optional)*
1223
+ '''
1224
+ params: T_JSON_DICT = dict()
1225
+ params['source'] = source.to_json()
1226
+ params['state'] = state.to_json()
1227
+ if own_contribution_estimate is not None:
1228
+ params['ownContributionEstimate'] = own_contribution_estimate
1229
+ cmd_dict: T_JSON_DICT = {
1230
+ 'method': 'Emulation.setPressureDataOverride',
1231
+ 'params': params,
1232
+ }
1233
+ json = yield cmd_dict
1234
+
1235
+
1236
+ def set_idle_override(
1237
+ is_user_active: bool,
1238
+ is_screen_unlocked: bool
1239
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1240
+ '''
1241
+ Overrides the Idle state.
1242
+
1243
+ :param is_user_active: Mock isUserActive
1244
+ :param is_screen_unlocked: Mock isScreenUnlocked
1245
+ '''
1246
+ params: T_JSON_DICT = dict()
1247
+ params['isUserActive'] = is_user_active
1248
+ params['isScreenUnlocked'] = is_screen_unlocked
1249
+ cmd_dict: T_JSON_DICT = {
1250
+ 'method': 'Emulation.setIdleOverride',
1251
+ 'params': params,
1252
+ }
1253
+ json = yield cmd_dict
1254
+
1255
+
1256
+ def clear_idle_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1257
+ '''
1258
+ Clears Idle state overrides.
1259
+ '''
1260
+ cmd_dict: T_JSON_DICT = {
1261
+ 'method': 'Emulation.clearIdleOverride',
1262
+ }
1263
+ json = yield cmd_dict
1264
+
1265
+
1266
+ @deprecated(version="1.3")
1267
+ def set_navigator_overrides(
1268
+ platform: str
1269
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1270
+ '''
1271
+ Overrides value returned by the javascript navigator object.
1272
+
1273
+ .. deprecated:: 1.3
1274
+
1275
+ **EXPERIMENTAL**
1276
+
1277
+ :param platform: The platform navigator.platform should return.
1278
+ '''
1279
+ params: T_JSON_DICT = dict()
1280
+ params['platform'] = platform
1281
+ cmd_dict: T_JSON_DICT = {
1282
+ 'method': 'Emulation.setNavigatorOverrides',
1283
+ 'params': params,
1284
+ }
1285
+ json = yield cmd_dict
1286
+
1287
+
1288
+ def set_page_scale_factor(
1289
+ page_scale_factor: float
1290
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1291
+ '''
1292
+ Sets a specified page scale factor.
1293
+
1294
+ **EXPERIMENTAL**
1295
+
1296
+ :param page_scale_factor: Page scale factor.
1297
+ '''
1298
+ params: T_JSON_DICT = dict()
1299
+ params['pageScaleFactor'] = page_scale_factor
1300
+ cmd_dict: T_JSON_DICT = {
1301
+ 'method': 'Emulation.setPageScaleFactor',
1302
+ 'params': params,
1303
+ }
1304
+ json = yield cmd_dict
1305
+
1306
+
1307
+ def set_script_execution_disabled(
1308
+ value: bool
1309
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1310
+ '''
1311
+ Switches script execution in the page.
1312
+
1313
+ :param value: Whether script execution should be disabled in the page.
1314
+ '''
1315
+ params: T_JSON_DICT = dict()
1316
+ params['value'] = value
1317
+ cmd_dict: T_JSON_DICT = {
1318
+ 'method': 'Emulation.setScriptExecutionDisabled',
1319
+ 'params': params,
1320
+ }
1321
+ json = yield cmd_dict
1322
+
1323
+
1324
+ def set_touch_emulation_enabled(
1325
+ enabled: bool,
1326
+ max_touch_points: typing.Optional[int] = None
1327
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1328
+ '''
1329
+ Enables touch on platforms which do not support them.
1330
+
1331
+ :param enabled: Whether the touch event emulation should be enabled.
1332
+ :param max_touch_points: *(Optional)* Maximum touch points supported. Defaults to one.
1333
+ '''
1334
+ params: T_JSON_DICT = dict()
1335
+ params['enabled'] = enabled
1336
+ if max_touch_points is not None:
1337
+ params['maxTouchPoints'] = max_touch_points
1338
+ cmd_dict: T_JSON_DICT = {
1339
+ 'method': 'Emulation.setTouchEmulationEnabled',
1340
+ 'params': params,
1341
+ }
1342
+ json = yield cmd_dict
1343
+
1344
+
1345
+ def set_virtual_time_policy(
1346
+ policy: VirtualTimePolicy,
1347
+ budget: typing.Optional[float] = None,
1348
+ max_virtual_time_task_starvation_count: typing.Optional[int] = None,
1349
+ initial_virtual_time: typing.Optional[network.TimeSinceEpoch] = None
1350
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]:
1351
+ '''
1352
+ Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
1353
+ the current virtual time policy. Note this supersedes any previous time budget.
1354
+
1355
+ **EXPERIMENTAL**
1356
+
1357
+ :param policy:
1358
+ :param budget: *(Optional)* If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
1359
+ :param max_virtual_time_task_starvation_count: *(Optional)* If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
1360
+ :param initial_virtual_time: *(Optional)* If set, base::Time::Now will be overridden to initially return this value.
1361
+ :returns: Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
1362
+ '''
1363
+ params: T_JSON_DICT = dict()
1364
+ params['policy'] = policy.to_json()
1365
+ if budget is not None:
1366
+ params['budget'] = budget
1367
+ if max_virtual_time_task_starvation_count is not None:
1368
+ params['maxVirtualTimeTaskStarvationCount'] = max_virtual_time_task_starvation_count
1369
+ if initial_virtual_time is not None:
1370
+ params['initialVirtualTime'] = initial_virtual_time.to_json()
1371
+ cmd_dict: T_JSON_DICT = {
1372
+ 'method': 'Emulation.setVirtualTimePolicy',
1373
+ 'params': params,
1374
+ }
1375
+ json = yield cmd_dict
1376
+ return float(json['virtualTimeTicksBase'])
1377
+
1378
+
1379
+ def set_locale_override(
1380
+ locale: typing.Optional[str] = None
1381
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1382
+ '''
1383
+ Overrides default host system locale with the specified one.
1384
+
1385
+ **EXPERIMENTAL**
1386
+
1387
+ :param locale: *(Optional)* ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
1388
+ '''
1389
+ params: T_JSON_DICT = dict()
1390
+ if locale is not None:
1391
+ params['locale'] = locale
1392
+ cmd_dict: T_JSON_DICT = {
1393
+ 'method': 'Emulation.setLocaleOverride',
1394
+ 'params': params,
1395
+ }
1396
+ json = yield cmd_dict
1397
+
1398
+
1399
+ def set_timezone_override(
1400
+ timezone_id: str
1401
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1402
+ '''
1403
+ Overrides default host system timezone with the specified one.
1404
+
1405
+ :param timezone_id: The timezone identifier. List of supported timezones: https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt If empty, disables the override and restores default host system timezone.
1406
+ '''
1407
+ params: T_JSON_DICT = dict()
1408
+ params['timezoneId'] = timezone_id
1409
+ cmd_dict: T_JSON_DICT = {
1410
+ 'method': 'Emulation.setTimezoneOverride',
1411
+ 'params': params,
1412
+ }
1413
+ json = yield cmd_dict
1414
+
1415
+
1416
+ @deprecated(version="1.3")
1417
+ def set_visible_size(
1418
+ width: int,
1419
+ height: int
1420
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1421
+ '''
1422
+ Resizes the frame/viewport of the page. Note that this does not affect the frame's container
1423
+ (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported
1424
+ on Android.
1425
+
1426
+ .. deprecated:: 1.3
1427
+
1428
+ **EXPERIMENTAL**
1429
+
1430
+ :param width: Frame width (DIP).
1431
+ :param height: Frame height (DIP).
1432
+ '''
1433
+ params: T_JSON_DICT = dict()
1434
+ params['width'] = width
1435
+ params['height'] = height
1436
+ cmd_dict: T_JSON_DICT = {
1437
+ 'method': 'Emulation.setVisibleSize',
1438
+ 'params': params,
1439
+ }
1440
+ json = yield cmd_dict
1441
+
1442
+
1443
+ def set_disabled_image_types(
1444
+ image_types: typing.List[DisabledImageType]
1445
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1446
+ '''
1447
+
1448
+
1449
+ **EXPERIMENTAL**
1450
+
1451
+ :param image_types: Image types to disable.
1452
+ '''
1453
+ params: T_JSON_DICT = dict()
1454
+ params['imageTypes'] = [i.to_json() for i in image_types]
1455
+ cmd_dict: T_JSON_DICT = {
1456
+ 'method': 'Emulation.setDisabledImageTypes',
1457
+ 'params': params,
1458
+ }
1459
+ json = yield cmd_dict
1460
+
1461
+
1462
+ def set_data_saver_override(
1463
+ data_saver_enabled: typing.Optional[bool] = None
1464
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1465
+ '''
1466
+ Override the value of navigator.connection.saveData
1467
+
1468
+ **EXPERIMENTAL**
1469
+
1470
+ :param data_saver_enabled: *(Optional)* Override value. Omitting the parameter disables the override.
1471
+ '''
1472
+ params: T_JSON_DICT = dict()
1473
+ if data_saver_enabled is not None:
1474
+ params['dataSaverEnabled'] = data_saver_enabled
1475
+ cmd_dict: T_JSON_DICT = {
1476
+ 'method': 'Emulation.setDataSaverOverride',
1477
+ 'params': params,
1478
+ }
1479
+ json = yield cmd_dict
1480
+
1481
+
1482
+ def set_hardware_concurrency_override(
1483
+ hardware_concurrency: int
1484
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1485
+ '''
1486
+
1487
+
1488
+ **EXPERIMENTAL**
1489
+
1490
+ :param hardware_concurrency: Hardware concurrency to report
1491
+ '''
1492
+ params: T_JSON_DICT = dict()
1493
+ params['hardwareConcurrency'] = hardware_concurrency
1494
+ cmd_dict: T_JSON_DICT = {
1495
+ 'method': 'Emulation.setHardwareConcurrencyOverride',
1496
+ 'params': params,
1497
+ }
1498
+ json = yield cmd_dict
1499
+
1500
+
1501
+ def set_user_agent_override(
1502
+ user_agent: str,
1503
+ accept_language: typing.Optional[str] = None,
1504
+ platform: typing.Optional[str] = None,
1505
+ user_agent_metadata: typing.Optional[UserAgentMetadata] = None
1506
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1507
+ '''
1508
+ Allows overriding user agent with the given string.
1509
+ ``userAgentMetadata`` must be set for Client Hint headers to be sent.
1510
+
1511
+ :param user_agent: User agent to use.
1512
+ :param accept_language: *(Optional)* Browser language to emulate.
1513
+ :param platform: *(Optional)* The platform navigator.platform should return.
1514
+ :param user_agent_metadata: **(EXPERIMENTAL)** *(Optional)* To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
1515
+ '''
1516
+ params: T_JSON_DICT = dict()
1517
+ params['userAgent'] = user_agent
1518
+ if accept_language is not None:
1519
+ params['acceptLanguage'] = accept_language
1520
+ if platform is not None:
1521
+ params['platform'] = platform
1522
+ if user_agent_metadata is not None:
1523
+ params['userAgentMetadata'] = user_agent_metadata.to_json()
1524
+ cmd_dict: T_JSON_DICT = {
1525
+ 'method': 'Emulation.setUserAgentOverride',
1526
+ 'params': params,
1527
+ }
1528
+ json = yield cmd_dict
1529
+
1530
+
1531
+ def set_automation_override(
1532
+ enabled: bool
1533
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1534
+ '''
1535
+ Allows overriding the automation flag.
1536
+
1537
+ **EXPERIMENTAL**
1538
+
1539
+ :param enabled: Whether the override should be enabled.
1540
+ '''
1541
+ params: T_JSON_DICT = dict()
1542
+ params['enabled'] = enabled
1543
+ cmd_dict: T_JSON_DICT = {
1544
+ 'method': 'Emulation.setAutomationOverride',
1545
+ 'params': params,
1546
+ }
1547
+ json = yield cmd_dict
1548
+
1549
+
1550
+ def set_small_viewport_height_difference_override(
1551
+ difference: int
1552
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1553
+ '''
1554
+ Allows overriding the difference between the small and large viewport sizes, which determine the
1555
+ value of the ``svh`` and ``lvh`` unit, respectively. Only supported for top-level frames.
1556
+
1557
+ **EXPERIMENTAL**
1558
+
1559
+ :param difference: This will cause an element of size 100svh to be ```difference``` pixels smaller than an element of size 100lvh.
1560
+ '''
1561
+ params: T_JSON_DICT = dict()
1562
+ params['difference'] = difference
1563
+ cmd_dict: T_JSON_DICT = {
1564
+ 'method': 'Emulation.setSmallViewportHeightDifferenceOverride',
1565
+ 'params': params,
1566
+ }
1567
+ json = yield cmd_dict
1568
+
1569
+
1570
+ def get_screen_infos() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[ScreenInfo]]:
1571
+ '''
1572
+ Returns device's screen configuration. In headful mode, the physical screens configuration is returned,
1573
+ whereas in headless mode, a virtual headless screen configuration is provided instead.
1574
+
1575
+ **EXPERIMENTAL**
1576
+
1577
+ :returns:
1578
+ '''
1579
+ cmd_dict: T_JSON_DICT = {
1580
+ 'method': 'Emulation.getScreenInfos',
1581
+ }
1582
+ json = yield cmd_dict
1583
+ return [ScreenInfo.from_json(i) for i in json['screenInfos']]
1584
+
1585
+
1586
+ def add_screen(
1587
+ left: int,
1588
+ top: int,
1589
+ width: int,
1590
+ height: int,
1591
+ work_area_insets: typing.Optional[WorkAreaInsets] = None,
1592
+ device_pixel_ratio: typing.Optional[float] = None,
1593
+ rotation: typing.Optional[int] = None,
1594
+ color_depth: typing.Optional[int] = None,
1595
+ label: typing.Optional[str] = None,
1596
+ is_internal: typing.Optional[bool] = None
1597
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,ScreenInfo]:
1598
+ '''
1599
+ Add a new screen to the device. Only supported in headless mode.
1600
+
1601
+ **EXPERIMENTAL**
1602
+
1603
+ :param left: Offset of the left edge of the screen in pixels.
1604
+ :param top: Offset of the top edge of the screen in pixels.
1605
+ :param width: The width of the screen in pixels.
1606
+ :param height: The height of the screen in pixels.
1607
+ :param work_area_insets: *(Optional)* Specifies the screen's work area. Default is entire screen.
1608
+ :param device_pixel_ratio: *(Optional)* Specifies the screen's device pixel ratio. Default is 1.
1609
+ :param rotation: *(Optional)* Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
1610
+ :param color_depth: *(Optional)* Specifies the screen's color depth in bits. Default is 24.
1611
+ :param label: *(Optional)* Specifies the descriptive label for the screen. Default is none.
1612
+ :param is_internal: *(Optional)* Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
1613
+ :returns:
1614
+ '''
1615
+ params: T_JSON_DICT = dict()
1616
+ params['left'] = left
1617
+ params['top'] = top
1618
+ params['width'] = width
1619
+ params['height'] = height
1620
+ if work_area_insets is not None:
1621
+ params['workAreaInsets'] = work_area_insets.to_json()
1622
+ if device_pixel_ratio is not None:
1623
+ params['devicePixelRatio'] = device_pixel_ratio
1624
+ if rotation is not None:
1625
+ params['rotation'] = rotation
1626
+ if color_depth is not None:
1627
+ params['colorDepth'] = color_depth
1628
+ if label is not None:
1629
+ params['label'] = label
1630
+ if is_internal is not None:
1631
+ params['isInternal'] = is_internal
1632
+ cmd_dict: T_JSON_DICT = {
1633
+ 'method': 'Emulation.addScreen',
1634
+ 'params': params,
1635
+ }
1636
+ json = yield cmd_dict
1637
+ return ScreenInfo.from_json(json['screenInfo'])
1638
+
1639
+
1640
+ def update_screen(
1641
+ screen_id: ScreenId,
1642
+ left: typing.Optional[int] = None,
1643
+ top: typing.Optional[int] = None,
1644
+ width: typing.Optional[int] = None,
1645
+ height: typing.Optional[int] = None,
1646
+ work_area_insets: typing.Optional[WorkAreaInsets] = None,
1647
+ device_pixel_ratio: typing.Optional[float] = None,
1648
+ rotation: typing.Optional[int] = None,
1649
+ color_depth: typing.Optional[int] = None,
1650
+ label: typing.Optional[str] = None,
1651
+ is_internal: typing.Optional[bool] = None
1652
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,ScreenInfo]:
1653
+ '''
1654
+ Updates specified screen parameters. Only supported in headless mode.
1655
+
1656
+ **EXPERIMENTAL**
1657
+
1658
+ :param screen_id: Target screen identifier.
1659
+ :param left: *(Optional)* Offset of the left edge of the screen in pixels.
1660
+ :param top: *(Optional)* Offset of the top edge of the screen in pixels.
1661
+ :param width: *(Optional)* The width of the screen in pixels.
1662
+ :param height: *(Optional)* The height of the screen in pixels.
1663
+ :param work_area_insets: *(Optional)* Specifies the screen's work area.
1664
+ :param device_pixel_ratio: *(Optional)* Specifies the screen's device pixel ratio.
1665
+ :param rotation: *(Optional)* Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
1666
+ :param color_depth: *(Optional)* Specifies the screen's color depth in bits.
1667
+ :param label: *(Optional)* Specifies the descriptive label for the screen.
1668
+ :param is_internal: *(Optional)* Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
1669
+ :returns:
1670
+ '''
1671
+ params: T_JSON_DICT = dict()
1672
+ params['screenId'] = screen_id.to_json()
1673
+ if left is not None:
1674
+ params['left'] = left
1675
+ if top is not None:
1676
+ params['top'] = top
1677
+ if width is not None:
1678
+ params['width'] = width
1679
+ if height is not None:
1680
+ params['height'] = height
1681
+ if work_area_insets is not None:
1682
+ params['workAreaInsets'] = work_area_insets.to_json()
1683
+ if device_pixel_ratio is not None:
1684
+ params['devicePixelRatio'] = device_pixel_ratio
1685
+ if rotation is not None:
1686
+ params['rotation'] = rotation
1687
+ if color_depth is not None:
1688
+ params['colorDepth'] = color_depth
1689
+ if label is not None:
1690
+ params['label'] = label
1691
+ if is_internal is not None:
1692
+ params['isInternal'] = is_internal
1693
+ cmd_dict: T_JSON_DICT = {
1694
+ 'method': 'Emulation.updateScreen',
1695
+ 'params': params,
1696
+ }
1697
+ json = yield cmd_dict
1698
+ return ScreenInfo.from_json(json['screenInfo'])
1699
+
1700
+
1701
+ def remove_screen(
1702
+ screen_id: ScreenId
1703
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1704
+ '''
1705
+ Remove screen from the device. Only supported in headless mode.
1706
+
1707
+ **EXPERIMENTAL**
1708
+
1709
+ :param screen_id:
1710
+ '''
1711
+ params: T_JSON_DICT = dict()
1712
+ params['screenId'] = screen_id.to_json()
1713
+ cmd_dict: T_JSON_DICT = {
1714
+ 'method': 'Emulation.removeScreen',
1715
+ 'params': params,
1716
+ }
1717
+ json = yield cmd_dict
1718
+
1719
+
1720
+ def set_primary_screen(
1721
+ screen_id: ScreenId
1722
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1723
+ '''
1724
+ Set primary screen. Only supported in headless mode.
1725
+ Note that this changes the coordinate system origin to the top-left
1726
+ of the new primary screen, updating the bounds and work areas
1727
+ of all existing screens accordingly.
1728
+
1729
+ **EXPERIMENTAL**
1730
+
1731
+ :param screen_id:
1732
+ '''
1733
+ params: T_JSON_DICT = dict()
1734
+ params['screenId'] = screen_id.to_json()
1735
+ cmd_dict: T_JSON_DICT = {
1736
+ 'method': 'Emulation.setPrimaryScreen',
1737
+ 'params': params,
1738
+ }
1739
+ json = yield cmd_dict
1740
+
1741
+
1742
+ @event_class('Emulation.virtualTimeBudgetExpired')
1743
+ @dataclass
1744
+ class VirtualTimeBudgetExpired:
1745
+ '''
1746
+ **EXPERIMENTAL**
1747
+
1748
+ Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
1749
+ '''
1750
+
1751
+
1752
+ @classmethod
1753
+ def from_json(cls, json: T_JSON_DICT) -> VirtualTimeBudgetExpired:
1754
+ return cls(
1755
+
1756
+ )
1757
+
1758
+
1759
+ @event_class('Emulation.screenOrientationLockChanged')
1760
+ @dataclass
1761
+ class ScreenOrientationLockChanged:
1762
+ '''
1763
+ **EXPERIMENTAL**
1764
+
1765
+ Fired when a page calls screen.orientation.lock() or screen.orientation.unlock()
1766
+ while device emulation is enabled. This allows the DevTools frontend to update the
1767
+ emulated device orientation accordingly.
1768
+ '''
1769
+ #: Whether the screen orientation is currently locked.
1770
+ locked: bool
1771
+ #: The orientation lock type requested by the page. Only set when locked is true.
1772
+ orientation: typing.Optional[ScreenOrientation]
1773
+
1774
+ @classmethod
1775
+ def from_json(cls, json: T_JSON_DICT) -> ScreenOrientationLockChanged:
1776
+ return cls(
1777
+ locked=bool(json['locked']),
1778
+ orientation=ScreenOrientation.from_json(json['orientation']) if json.get('orientation', None) is not None else None
1779
+ )