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,1589 @@
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: Runtime
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
+
15
+ class ScriptId(str):
16
+ '''
17
+ Unique script identifier.
18
+ '''
19
+ def to_json(self) -> str:
20
+ return self
21
+
22
+ @classmethod
23
+ def from_json(cls, json: str) -> ScriptId:
24
+ return cls(json)
25
+
26
+ def __repr__(self):
27
+ return 'ScriptId({})'.format(super().__repr__())
28
+
29
+
30
+ @dataclass
31
+ class SerializationOptions:
32
+ '''
33
+ Represents options for serialization. Overrides ``generatePreview`` and ``returnByValue``.
34
+ '''
35
+ serialization: str
36
+
37
+ #: Deep serialization depth. Default is full depth. Respected only in ``deep`` serialization mode.
38
+ max_depth: typing.Optional[int] = None
39
+
40
+ #: Embedder-specific parameters. For example if connected to V8 in Chrome these control DOM
41
+ #: serialization via ``maxNodeDepth: integer`` and ``includeShadowTree: "none" `` "open" `` "all"``.
42
+ #: Values can be only of type string or integer.
43
+ additional_parameters: typing.Optional[dict] = None
44
+
45
+ def to_json(self) -> T_JSON_DICT:
46
+ json: T_JSON_DICT = dict()
47
+ json['serialization'] = self.serialization
48
+ if self.max_depth is not None:
49
+ json['maxDepth'] = self.max_depth
50
+ if self.additional_parameters is not None:
51
+ json['additionalParameters'] = self.additional_parameters
52
+ return json
53
+
54
+ @classmethod
55
+ def from_json(cls, json: T_JSON_DICT) -> SerializationOptions:
56
+ return cls(
57
+ serialization=str(json['serialization']),
58
+ max_depth=int(json['maxDepth']) if json.get('maxDepth', None) is not None else None,
59
+ additional_parameters=dict(json['additionalParameters']) if json.get('additionalParameters', None) is not None else None,
60
+ )
61
+
62
+
63
+ @dataclass
64
+ class DeepSerializedValue:
65
+ '''
66
+ Represents deep serialized value.
67
+ '''
68
+ type_: str
69
+
70
+ value: typing.Optional[typing.Any] = None
71
+
72
+ object_id: typing.Optional[str] = None
73
+
74
+ #: Set if value reference met more then once during serialization. In such
75
+ #: case, value is provided only to one of the serialized values. Unique
76
+ #: per value in the scope of one CDP call.
77
+ weak_local_object_reference: typing.Optional[int] = None
78
+
79
+ def to_json(self) -> T_JSON_DICT:
80
+ json: T_JSON_DICT = dict()
81
+ json['type'] = self.type_
82
+ if self.value is not None:
83
+ json['value'] = self.value
84
+ if self.object_id is not None:
85
+ json['objectId'] = self.object_id
86
+ if self.weak_local_object_reference is not None:
87
+ json['weakLocalObjectReference'] = self.weak_local_object_reference
88
+ return json
89
+
90
+ @classmethod
91
+ def from_json(cls, json: T_JSON_DICT) -> DeepSerializedValue:
92
+ return cls(
93
+ type_=str(json['type']),
94
+ value=json['value'] if json.get('value', None) is not None else None,
95
+ object_id=str(json['objectId']) if json.get('objectId', None) is not None else None,
96
+ weak_local_object_reference=int(json['weakLocalObjectReference']) if json.get('weakLocalObjectReference', None) is not None else None,
97
+ )
98
+
99
+
100
+ class RemoteObjectId(str):
101
+ '''
102
+ Unique object identifier.
103
+ '''
104
+ def to_json(self) -> str:
105
+ return self
106
+
107
+ @classmethod
108
+ def from_json(cls, json: str) -> RemoteObjectId:
109
+ return cls(json)
110
+
111
+ def __repr__(self):
112
+ return 'RemoteObjectId({})'.format(super().__repr__())
113
+
114
+
115
+ class UnserializableValue(str):
116
+ '''
117
+ Primitive value which cannot be JSON-stringified. Includes values ``-0``, ``NaN``, ``Infinity``,
118
+ ``-Infinity``, and bigint literals.
119
+ '''
120
+ def to_json(self) -> str:
121
+ return self
122
+
123
+ @classmethod
124
+ def from_json(cls, json: str) -> UnserializableValue:
125
+ return cls(json)
126
+
127
+ def __repr__(self):
128
+ return 'UnserializableValue({})'.format(super().__repr__())
129
+
130
+
131
+ @dataclass
132
+ class RemoteObject:
133
+ '''
134
+ Mirror object referencing original JavaScript object.
135
+ '''
136
+ #: Object type.
137
+ type_: str
138
+
139
+ #: Object subtype hint. Specified for ``object`` type values only.
140
+ #: NOTE: If you change anything here, make sure to also update
141
+ #: ``subtype`` in ``ObjectPreview`` and ``PropertyPreview`` below.
142
+ subtype: typing.Optional[str] = None
143
+
144
+ #: Object class (constructor) name. Specified for ``object`` type values only.
145
+ class_name: typing.Optional[str] = None
146
+
147
+ #: Remote object value in case of primitive values or JSON values (if it was requested).
148
+ value: typing.Optional[typing.Any] = None
149
+
150
+ #: Primitive value which can not be JSON-stringified does not have ``value``, but gets this
151
+ #: property.
152
+ unserializable_value: typing.Optional[UnserializableValue] = None
153
+
154
+ #: String representation of the object.
155
+ description: typing.Optional[str] = None
156
+
157
+ #: Deep serialized value.
158
+ deep_serialized_value: typing.Optional[DeepSerializedValue] = None
159
+
160
+ #: Unique object identifier (for non-primitive values).
161
+ object_id: typing.Optional[RemoteObjectId] = None
162
+
163
+ #: Preview containing abbreviated property values. Specified for ``object`` type values only.
164
+ preview: typing.Optional[ObjectPreview] = None
165
+
166
+ custom_preview: typing.Optional[CustomPreview] = None
167
+
168
+ def to_json(self) -> T_JSON_DICT:
169
+ json: T_JSON_DICT = dict()
170
+ json['type'] = self.type_
171
+ if self.subtype is not None:
172
+ json['subtype'] = self.subtype
173
+ if self.class_name is not None:
174
+ json['className'] = self.class_name
175
+ if self.value is not None:
176
+ json['value'] = self.value
177
+ if self.unserializable_value is not None:
178
+ json['unserializableValue'] = self.unserializable_value.to_json()
179
+ if self.description is not None:
180
+ json['description'] = self.description
181
+ if self.deep_serialized_value is not None:
182
+ json['deepSerializedValue'] = self.deep_serialized_value.to_json()
183
+ if self.object_id is not None:
184
+ json['objectId'] = self.object_id.to_json()
185
+ if self.preview is not None:
186
+ json['preview'] = self.preview.to_json()
187
+ if self.custom_preview is not None:
188
+ json['customPreview'] = self.custom_preview.to_json()
189
+ return json
190
+
191
+ @classmethod
192
+ def from_json(cls, json: T_JSON_DICT) -> RemoteObject:
193
+ return cls(
194
+ type_=str(json['type']),
195
+ subtype=str(json['subtype']) if json.get('subtype', None) is not None else None,
196
+ class_name=str(json['className']) if json.get('className', None) is not None else None,
197
+ value=json['value'] if json.get('value', None) is not None else None,
198
+ unserializable_value=UnserializableValue.from_json(json['unserializableValue']) if json.get('unserializableValue', None) is not None else None,
199
+ description=str(json['description']) if json.get('description', None) is not None else None,
200
+ deep_serialized_value=DeepSerializedValue.from_json(json['deepSerializedValue']) if json.get('deepSerializedValue', None) is not None else None,
201
+ object_id=RemoteObjectId.from_json(json['objectId']) if json.get('objectId', None) is not None else None,
202
+ preview=ObjectPreview.from_json(json['preview']) if json.get('preview', None) is not None else None,
203
+ custom_preview=CustomPreview.from_json(json['customPreview']) if json.get('customPreview', None) is not None else None,
204
+ )
205
+
206
+
207
+ @dataclass
208
+ class CustomPreview:
209
+ #: The JSON-stringified result of formatter.header(object, config) call.
210
+ #: It contains json ML array that represents RemoteObject.
211
+ header: str
212
+
213
+ #: If formatter returns true as a result of formatter.hasBody call then bodyGetterId will
214
+ #: contain RemoteObjectId for the function that returns result of formatter.body(object, config) call.
215
+ #: The result value is json ML array.
216
+ body_getter_id: typing.Optional[RemoteObjectId] = None
217
+
218
+ def to_json(self) -> T_JSON_DICT:
219
+ json: T_JSON_DICT = dict()
220
+ json['header'] = self.header
221
+ if self.body_getter_id is not None:
222
+ json['bodyGetterId'] = self.body_getter_id.to_json()
223
+ return json
224
+
225
+ @classmethod
226
+ def from_json(cls, json: T_JSON_DICT) -> CustomPreview:
227
+ return cls(
228
+ header=str(json['header']),
229
+ body_getter_id=RemoteObjectId.from_json(json['bodyGetterId']) if json.get('bodyGetterId', None) is not None else None,
230
+ )
231
+
232
+
233
+ @dataclass
234
+ class ObjectPreview:
235
+ '''
236
+ Object containing abbreviated remote object value.
237
+ '''
238
+ #: Object type.
239
+ type_: str
240
+
241
+ #: True iff some of the properties or entries of the original object did not fit.
242
+ overflow: bool
243
+
244
+ #: List of the properties.
245
+ properties: typing.List[PropertyPreview]
246
+
247
+ #: Object subtype hint. Specified for ``object`` type values only.
248
+ subtype: typing.Optional[str] = None
249
+
250
+ #: String representation of the object.
251
+ description: typing.Optional[str] = None
252
+
253
+ #: List of the entries. Specified for ``map`` and ``set`` subtype values only.
254
+ entries: typing.Optional[typing.List[EntryPreview]] = None
255
+
256
+ def to_json(self) -> T_JSON_DICT:
257
+ json: T_JSON_DICT = dict()
258
+ json['type'] = self.type_
259
+ json['overflow'] = self.overflow
260
+ json['properties'] = [i.to_json() for i in self.properties]
261
+ if self.subtype is not None:
262
+ json['subtype'] = self.subtype
263
+ if self.description is not None:
264
+ json['description'] = self.description
265
+ if self.entries is not None:
266
+ json['entries'] = [i.to_json() for i in self.entries]
267
+ return json
268
+
269
+ @classmethod
270
+ def from_json(cls, json: T_JSON_DICT) -> ObjectPreview:
271
+ return cls(
272
+ type_=str(json['type']),
273
+ overflow=bool(json['overflow']),
274
+ properties=[PropertyPreview.from_json(i) for i in json['properties']],
275
+ subtype=str(json['subtype']) if json.get('subtype', None) is not None else None,
276
+ description=str(json['description']) if json.get('description', None) is not None else None,
277
+ entries=[EntryPreview.from_json(i) for i in json['entries']] if json.get('entries', None) is not None else None,
278
+ )
279
+
280
+
281
+ @dataclass
282
+ class PropertyPreview:
283
+ #: Property name.
284
+ name: str
285
+
286
+ #: Object type. Accessor means that the property itself is an accessor property.
287
+ type_: str
288
+
289
+ #: User-friendly property value string.
290
+ value: typing.Optional[str] = None
291
+
292
+ #: Nested value preview.
293
+ value_preview: typing.Optional[ObjectPreview] = None
294
+
295
+ #: Object subtype hint. Specified for ``object`` type values only.
296
+ subtype: typing.Optional[str] = None
297
+
298
+ def to_json(self) -> T_JSON_DICT:
299
+ json: T_JSON_DICT = dict()
300
+ json['name'] = self.name
301
+ json['type'] = self.type_
302
+ if self.value is not None:
303
+ json['value'] = self.value
304
+ if self.value_preview is not None:
305
+ json['valuePreview'] = self.value_preview.to_json()
306
+ if self.subtype is not None:
307
+ json['subtype'] = self.subtype
308
+ return json
309
+
310
+ @classmethod
311
+ def from_json(cls, json: T_JSON_DICT) -> PropertyPreview:
312
+ return cls(
313
+ name=str(json['name']),
314
+ type_=str(json['type']),
315
+ value=str(json['value']) if json.get('value', None) is not None else None,
316
+ value_preview=ObjectPreview.from_json(json['valuePreview']) if json.get('valuePreview', None) is not None else None,
317
+ subtype=str(json['subtype']) if json.get('subtype', None) is not None else None,
318
+ )
319
+
320
+
321
+ @dataclass
322
+ class EntryPreview:
323
+ #: Preview of the value.
324
+ value: ObjectPreview
325
+
326
+ #: Preview of the key. Specified for map-like collection entries.
327
+ key: typing.Optional[ObjectPreview] = None
328
+
329
+ def to_json(self) -> T_JSON_DICT:
330
+ json: T_JSON_DICT = dict()
331
+ json['value'] = self.value.to_json()
332
+ if self.key is not None:
333
+ json['key'] = self.key.to_json()
334
+ return json
335
+
336
+ @classmethod
337
+ def from_json(cls, json: T_JSON_DICT) -> EntryPreview:
338
+ return cls(
339
+ value=ObjectPreview.from_json(json['value']),
340
+ key=ObjectPreview.from_json(json['key']) if json.get('key', None) is not None else None,
341
+ )
342
+
343
+
344
+ @dataclass
345
+ class PropertyDescriptor:
346
+ '''
347
+ Object property descriptor.
348
+ '''
349
+ #: Property name or symbol description.
350
+ name: str
351
+
352
+ #: True if the type of this property descriptor may be changed and if the property may be
353
+ #: deleted from the corresponding object.
354
+ configurable: bool
355
+
356
+ #: True if this property shows up during enumeration of the properties on the corresponding
357
+ #: object.
358
+ enumerable: bool
359
+
360
+ #: The value associated with the property.
361
+ value: typing.Optional[RemoteObject] = None
362
+
363
+ #: True if the value associated with the property may be changed (data descriptors only).
364
+ writable: typing.Optional[bool] = None
365
+
366
+ #: A function which serves as a getter for the property, or ``undefined`` if there is no getter
367
+ #: (accessor descriptors only).
368
+ get: typing.Optional[RemoteObject] = None
369
+
370
+ #: A function which serves as a setter for the property, or ``undefined`` if there is no setter
371
+ #: (accessor descriptors only).
372
+ set_: typing.Optional[RemoteObject] = None
373
+
374
+ #: True if the result was thrown during the evaluation.
375
+ was_thrown: typing.Optional[bool] = None
376
+
377
+ #: True if the property is owned for the object.
378
+ is_own: typing.Optional[bool] = None
379
+
380
+ #: Property symbol object, if the property is of the ``symbol`` type.
381
+ symbol: typing.Optional[RemoteObject] = None
382
+
383
+ def to_json(self) -> T_JSON_DICT:
384
+ json: T_JSON_DICT = dict()
385
+ json['name'] = self.name
386
+ json['configurable'] = self.configurable
387
+ json['enumerable'] = self.enumerable
388
+ if self.value is not None:
389
+ json['value'] = self.value.to_json()
390
+ if self.writable is not None:
391
+ json['writable'] = self.writable
392
+ if self.get is not None:
393
+ json['get'] = self.get.to_json()
394
+ if self.set_ is not None:
395
+ json['set'] = self.set_.to_json()
396
+ if self.was_thrown is not None:
397
+ json['wasThrown'] = self.was_thrown
398
+ if self.is_own is not None:
399
+ json['isOwn'] = self.is_own
400
+ if self.symbol is not None:
401
+ json['symbol'] = self.symbol.to_json()
402
+ return json
403
+
404
+ @classmethod
405
+ def from_json(cls, json: T_JSON_DICT) -> PropertyDescriptor:
406
+ return cls(
407
+ name=str(json['name']),
408
+ configurable=bool(json['configurable']),
409
+ enumerable=bool(json['enumerable']),
410
+ value=RemoteObject.from_json(json['value']) if json.get('value', None) is not None else None,
411
+ writable=bool(json['writable']) if json.get('writable', None) is not None else None,
412
+ get=RemoteObject.from_json(json['get']) if json.get('get', None) is not None else None,
413
+ set_=RemoteObject.from_json(json['set']) if json.get('set', None) is not None else None,
414
+ was_thrown=bool(json['wasThrown']) if json.get('wasThrown', None) is not None else None,
415
+ is_own=bool(json['isOwn']) if json.get('isOwn', None) is not None else None,
416
+ symbol=RemoteObject.from_json(json['symbol']) if json.get('symbol', None) is not None else None,
417
+ )
418
+
419
+
420
+ @dataclass
421
+ class InternalPropertyDescriptor:
422
+ '''
423
+ Object internal property descriptor. This property isn't normally visible in JavaScript code.
424
+ '''
425
+ #: Conventional property name.
426
+ name: str
427
+
428
+ #: The value associated with the property.
429
+ value: typing.Optional[RemoteObject] = None
430
+
431
+ def to_json(self) -> T_JSON_DICT:
432
+ json: T_JSON_DICT = dict()
433
+ json['name'] = self.name
434
+ if self.value is not None:
435
+ json['value'] = self.value.to_json()
436
+ return json
437
+
438
+ @classmethod
439
+ def from_json(cls, json: T_JSON_DICT) -> InternalPropertyDescriptor:
440
+ return cls(
441
+ name=str(json['name']),
442
+ value=RemoteObject.from_json(json['value']) if json.get('value', None) is not None else None,
443
+ )
444
+
445
+
446
+ @dataclass
447
+ class PrivatePropertyDescriptor:
448
+ '''
449
+ Object private field descriptor.
450
+ '''
451
+ #: Private property name.
452
+ name: str
453
+
454
+ #: The value associated with the private property.
455
+ value: typing.Optional[RemoteObject] = None
456
+
457
+ #: A function which serves as a getter for the private property,
458
+ #: or ``undefined`` if there is no getter (accessor descriptors only).
459
+ get: typing.Optional[RemoteObject] = None
460
+
461
+ #: A function which serves as a setter for the private property,
462
+ #: or ``undefined`` if there is no setter (accessor descriptors only).
463
+ set_: typing.Optional[RemoteObject] = None
464
+
465
+ def to_json(self) -> T_JSON_DICT:
466
+ json: T_JSON_DICT = dict()
467
+ json['name'] = self.name
468
+ if self.value is not None:
469
+ json['value'] = self.value.to_json()
470
+ if self.get is not None:
471
+ json['get'] = self.get.to_json()
472
+ if self.set_ is not None:
473
+ json['set'] = self.set_.to_json()
474
+ return json
475
+
476
+ @classmethod
477
+ def from_json(cls, json: T_JSON_DICT) -> PrivatePropertyDescriptor:
478
+ return cls(
479
+ name=str(json['name']),
480
+ value=RemoteObject.from_json(json['value']) if json.get('value', None) is not None else None,
481
+ get=RemoteObject.from_json(json['get']) if json.get('get', None) is not None else None,
482
+ set_=RemoteObject.from_json(json['set']) if json.get('set', None) is not None else None,
483
+ )
484
+
485
+
486
+ @dataclass
487
+ class CallArgument:
488
+ '''
489
+ Represents function call argument. Either remote object id ``objectId``, primitive ``value``,
490
+ unserializable primitive value or neither of (for undefined) them should be specified.
491
+ '''
492
+ #: Primitive value or serializable javascript object.
493
+ value: typing.Optional[typing.Any] = None
494
+
495
+ #: Primitive value which can not be JSON-stringified.
496
+ unserializable_value: typing.Optional[UnserializableValue] = None
497
+
498
+ #: Remote object handle.
499
+ object_id: typing.Optional[RemoteObjectId] = None
500
+
501
+ def to_json(self) -> T_JSON_DICT:
502
+ json: T_JSON_DICT = dict()
503
+ if self.value is not None:
504
+ json['value'] = self.value
505
+ if self.unserializable_value is not None:
506
+ json['unserializableValue'] = self.unserializable_value.to_json()
507
+ if self.object_id is not None:
508
+ json['objectId'] = self.object_id.to_json()
509
+ return json
510
+
511
+ @classmethod
512
+ def from_json(cls, json: T_JSON_DICT) -> CallArgument:
513
+ return cls(
514
+ value=json['value'] if json.get('value', None) is not None else None,
515
+ unserializable_value=UnserializableValue.from_json(json['unserializableValue']) if json.get('unserializableValue', None) is not None else None,
516
+ object_id=RemoteObjectId.from_json(json['objectId']) if json.get('objectId', None) is not None else None,
517
+ )
518
+
519
+
520
+ class ExecutionContextId(int):
521
+ '''
522
+ Id of an execution context.
523
+ '''
524
+ def to_json(self) -> int:
525
+ return self
526
+
527
+ @classmethod
528
+ def from_json(cls, json: int) -> ExecutionContextId:
529
+ return cls(json)
530
+
531
+ def __repr__(self):
532
+ return 'ExecutionContextId({})'.format(super().__repr__())
533
+
534
+
535
+ @dataclass
536
+ class ExecutionContextDescription:
537
+ '''
538
+ Description of an isolated world.
539
+ '''
540
+ #: Unique id of the execution context. It can be used to specify in which execution context
541
+ #: script evaluation should be performed.
542
+ id_: ExecutionContextId
543
+
544
+ #: Execution context origin.
545
+ origin: str
546
+
547
+ #: Human readable name describing given context.
548
+ name: str
549
+
550
+ #: A system-unique execution context identifier. Unlike the id, this is unique across
551
+ #: multiple processes, so can be reliably used to identify specific context while backend
552
+ #: performs a cross-process navigation.
553
+ unique_id: str
554
+
555
+ #: Embedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'``'isolated'``'worker', frameId: string}
556
+ aux_data: typing.Optional[dict] = None
557
+
558
+ def to_json(self) -> T_JSON_DICT:
559
+ json: T_JSON_DICT = dict()
560
+ json['id'] = self.id_.to_json()
561
+ json['origin'] = self.origin
562
+ json['name'] = self.name
563
+ json['uniqueId'] = self.unique_id
564
+ if self.aux_data is not None:
565
+ json['auxData'] = self.aux_data
566
+ return json
567
+
568
+ @classmethod
569
+ def from_json(cls, json: T_JSON_DICT) -> ExecutionContextDescription:
570
+ return cls(
571
+ id_=ExecutionContextId.from_json(json['id']),
572
+ origin=str(json['origin']),
573
+ name=str(json['name']),
574
+ unique_id=str(json['uniqueId']),
575
+ aux_data=dict(json['auxData']) if json.get('auxData', None) is not None else None,
576
+ )
577
+
578
+
579
+ @dataclass
580
+ class ExceptionDetails:
581
+ '''
582
+ Detailed information about exception (or error) that was thrown during script compilation or
583
+ execution.
584
+ '''
585
+ #: Exception id.
586
+ exception_id: int
587
+
588
+ #: Exception text, which should be used together with exception object when available.
589
+ text: str
590
+
591
+ #: Line number of the exception location (0-based).
592
+ line_number: int
593
+
594
+ #: Column number of the exception location (0-based).
595
+ column_number: int
596
+
597
+ #: Script ID of the exception location.
598
+ script_id: typing.Optional[ScriptId] = None
599
+
600
+ #: URL of the exception location, to be used when the script was not reported.
601
+ url: typing.Optional[str] = None
602
+
603
+ #: JavaScript stack trace if available.
604
+ stack_trace: typing.Optional[StackTrace] = None
605
+
606
+ #: Exception object if available.
607
+ exception: typing.Optional[RemoteObject] = None
608
+
609
+ #: Identifier of the context where exception happened.
610
+ execution_context_id: typing.Optional[ExecutionContextId] = None
611
+
612
+ #: Dictionary with entries of meta data that the client associated
613
+ #: with this exception, such as information about associated network
614
+ #: requests, etc.
615
+ exception_meta_data: typing.Optional[dict] = None
616
+
617
+ def to_json(self) -> T_JSON_DICT:
618
+ json: T_JSON_DICT = dict()
619
+ json['exceptionId'] = self.exception_id
620
+ json['text'] = self.text
621
+ json['lineNumber'] = self.line_number
622
+ json['columnNumber'] = self.column_number
623
+ if self.script_id is not None:
624
+ json['scriptId'] = self.script_id.to_json()
625
+ if self.url is not None:
626
+ json['url'] = self.url
627
+ if self.stack_trace is not None:
628
+ json['stackTrace'] = self.stack_trace.to_json()
629
+ if self.exception is not None:
630
+ json['exception'] = self.exception.to_json()
631
+ if self.execution_context_id is not None:
632
+ json['executionContextId'] = self.execution_context_id.to_json()
633
+ if self.exception_meta_data is not None:
634
+ json['exceptionMetaData'] = self.exception_meta_data
635
+ return json
636
+
637
+ @classmethod
638
+ def from_json(cls, json: T_JSON_DICT) -> ExceptionDetails:
639
+ return cls(
640
+ exception_id=int(json['exceptionId']),
641
+ text=str(json['text']),
642
+ line_number=int(json['lineNumber']),
643
+ column_number=int(json['columnNumber']),
644
+ script_id=ScriptId.from_json(json['scriptId']) if json.get('scriptId', None) is not None else None,
645
+ url=str(json['url']) if json.get('url', None) is not None else None,
646
+ stack_trace=StackTrace.from_json(json['stackTrace']) if json.get('stackTrace', None) is not None else None,
647
+ exception=RemoteObject.from_json(json['exception']) if json.get('exception', None) is not None else None,
648
+ execution_context_id=ExecutionContextId.from_json(json['executionContextId']) if json.get('executionContextId', None) is not None else None,
649
+ exception_meta_data=dict(json['exceptionMetaData']) if json.get('exceptionMetaData', None) is not None else None,
650
+ )
651
+
652
+
653
+ class Timestamp(float):
654
+ '''
655
+ Number of milliseconds since epoch.
656
+ '''
657
+ def to_json(self) -> float:
658
+ return self
659
+
660
+ @classmethod
661
+ def from_json(cls, json: float) -> Timestamp:
662
+ return cls(json)
663
+
664
+ def __repr__(self):
665
+ return 'Timestamp({})'.format(super().__repr__())
666
+
667
+
668
+ class TimeDelta(float):
669
+ '''
670
+ Number of milliseconds.
671
+ '''
672
+ def to_json(self) -> float:
673
+ return self
674
+
675
+ @classmethod
676
+ def from_json(cls, json: float) -> TimeDelta:
677
+ return cls(json)
678
+
679
+ def __repr__(self):
680
+ return 'TimeDelta({})'.format(super().__repr__())
681
+
682
+
683
+ @dataclass
684
+ class CallFrame:
685
+ '''
686
+ Stack entry for runtime errors and assertions.
687
+ '''
688
+ #: JavaScript function name.
689
+ function_name: str
690
+
691
+ #: JavaScript script id.
692
+ script_id: ScriptId
693
+
694
+ #: JavaScript script name or url.
695
+ url: str
696
+
697
+ #: JavaScript script line number (0-based).
698
+ line_number: int
699
+
700
+ #: JavaScript script column number (0-based).
701
+ column_number: int
702
+
703
+ def to_json(self) -> T_JSON_DICT:
704
+ json: T_JSON_DICT = dict()
705
+ json['functionName'] = self.function_name
706
+ json['scriptId'] = self.script_id.to_json()
707
+ json['url'] = self.url
708
+ json['lineNumber'] = self.line_number
709
+ json['columnNumber'] = self.column_number
710
+ return json
711
+
712
+ @classmethod
713
+ def from_json(cls, json: T_JSON_DICT) -> CallFrame:
714
+ return cls(
715
+ function_name=str(json['functionName']),
716
+ script_id=ScriptId.from_json(json['scriptId']),
717
+ url=str(json['url']),
718
+ line_number=int(json['lineNumber']),
719
+ column_number=int(json['columnNumber']),
720
+ )
721
+
722
+
723
+ @dataclass
724
+ class StackTrace:
725
+ '''
726
+ Call frames for assertions or error messages.
727
+ '''
728
+ #: JavaScript function name.
729
+ call_frames: typing.List[CallFrame]
730
+
731
+ #: String label of this stack trace. For async traces this may be a name of the function that
732
+ #: initiated the async call.
733
+ description: typing.Optional[str] = None
734
+
735
+ #: Asynchronous JavaScript stack trace that preceded this stack, if available.
736
+ parent: typing.Optional[StackTrace] = None
737
+
738
+ #: Asynchronous JavaScript stack trace that preceded this stack, if available.
739
+ parent_id: typing.Optional[StackTraceId] = None
740
+
741
+ def to_json(self) -> T_JSON_DICT:
742
+ json: T_JSON_DICT = dict()
743
+ json['callFrames'] = [i.to_json() for i in self.call_frames]
744
+ if self.description is not None:
745
+ json['description'] = self.description
746
+ if self.parent is not None:
747
+ json['parent'] = self.parent.to_json()
748
+ if self.parent_id is not None:
749
+ json['parentId'] = self.parent_id.to_json()
750
+ return json
751
+
752
+ @classmethod
753
+ def from_json(cls, json: T_JSON_DICT) -> StackTrace:
754
+ return cls(
755
+ call_frames=[CallFrame.from_json(i) for i in json['callFrames']],
756
+ description=str(json['description']) if json.get('description', None) is not None else None,
757
+ parent=StackTrace.from_json(json['parent']) if json.get('parent', None) is not None else None,
758
+ parent_id=StackTraceId.from_json(json['parentId']) if json.get('parentId', None) is not None else None,
759
+ )
760
+
761
+
762
+ class UniqueDebuggerId(str):
763
+ '''
764
+ Unique identifier of current debugger.
765
+ '''
766
+ def to_json(self) -> str:
767
+ return self
768
+
769
+ @classmethod
770
+ def from_json(cls, json: str) -> UniqueDebuggerId:
771
+ return cls(json)
772
+
773
+ def __repr__(self):
774
+ return 'UniqueDebuggerId({})'.format(super().__repr__())
775
+
776
+
777
+ @dataclass
778
+ class StackTraceId:
779
+ '''
780
+ If ``debuggerId`` is set stack trace comes from another debugger and can be resolved there. This
781
+ allows to track cross-debugger calls. See ``Runtime.StackTrace`` and ``Debugger.paused`` for usages.
782
+ '''
783
+ id_: str
784
+
785
+ debugger_id: typing.Optional[UniqueDebuggerId] = None
786
+
787
+ def to_json(self) -> T_JSON_DICT:
788
+ json: T_JSON_DICT = dict()
789
+ json['id'] = self.id_
790
+ if self.debugger_id is not None:
791
+ json['debuggerId'] = self.debugger_id.to_json()
792
+ return json
793
+
794
+ @classmethod
795
+ def from_json(cls, json: T_JSON_DICT) -> StackTraceId:
796
+ return cls(
797
+ id_=str(json['id']),
798
+ debugger_id=UniqueDebuggerId.from_json(json['debuggerId']) if json.get('debuggerId', None) is not None else None,
799
+ )
800
+
801
+
802
+ def await_promise(
803
+ promise_object_id: RemoteObjectId,
804
+ return_by_value: typing.Optional[bool] = None,
805
+ generate_preview: typing.Optional[bool] = None
806
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[RemoteObject, typing.Optional[ExceptionDetails]]]:
807
+ '''
808
+ Add handler to promise with given promise object id.
809
+
810
+ :param promise_object_id: Identifier of the promise.
811
+ :param return_by_value: *(Optional)* Whether the result is expected to be a JSON object that should be sent by value.
812
+ :param generate_preview: *(Optional)* Whether preview should be generated for the result.
813
+ :returns: A tuple with the following items:
814
+
815
+ 0. **result** - Promise result. Will contain rejected value if promise was rejected.
816
+ 1. **exceptionDetails** - *(Optional)* Exception details if stack strace is available.
817
+ '''
818
+ params: T_JSON_DICT = dict()
819
+ params['promiseObjectId'] = promise_object_id.to_json()
820
+ if return_by_value is not None:
821
+ params['returnByValue'] = return_by_value
822
+ if generate_preview is not None:
823
+ params['generatePreview'] = generate_preview
824
+ cmd_dict: T_JSON_DICT = {
825
+ 'method': 'Runtime.awaitPromise',
826
+ 'params': params,
827
+ }
828
+ json = yield cmd_dict
829
+ return (
830
+ RemoteObject.from_json(json['result']),
831
+ ExceptionDetails.from_json(json['exceptionDetails']) if json.get('exceptionDetails', None) is not None else None
832
+ )
833
+
834
+
835
+ def call_function_on(
836
+ function_declaration: str,
837
+ object_id: typing.Optional[RemoteObjectId] = None,
838
+ arguments: typing.Optional[typing.List[CallArgument]] = None,
839
+ silent: typing.Optional[bool] = None,
840
+ return_by_value: typing.Optional[bool] = None,
841
+ generate_preview: typing.Optional[bool] = None,
842
+ user_gesture: typing.Optional[bool] = None,
843
+ await_promise: typing.Optional[bool] = None,
844
+ execution_context_id: typing.Optional[ExecutionContextId] = None,
845
+ object_group: typing.Optional[str] = None,
846
+ throw_on_side_effect: typing.Optional[bool] = None,
847
+ unique_context_id: typing.Optional[str] = None,
848
+ serialization_options: typing.Optional[SerializationOptions] = None
849
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[RemoteObject, typing.Optional[ExceptionDetails]]]:
850
+ '''
851
+ Calls function with given declaration on the given object. Object group of the result is
852
+ inherited from the target object.
853
+
854
+ :param function_declaration: Declaration of the function to call.
855
+ :param object_id: *(Optional)* Identifier of the object to call function on. Either objectId or executionContextId should be specified.
856
+ :param arguments: *(Optional)* Call arguments. All call arguments must belong to the same JavaScript world as the target object.
857
+ :param silent: *(Optional)* In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides ```setPauseOnException```` state.
858
+ :param return_by_value: *(Optional)* Whether the result is expected to be a JSON object which should be sent by value. Can be overriden by ````serializationOptions````.
859
+ :param generate_preview: **(EXPERIMENTAL)** *(Optional)* Whether preview should be generated for the result.
860
+ :param user_gesture: *(Optional)* Whether execution should be treated as initiated by user in the UI.
861
+ :param await_promise: *(Optional)* Whether execution should ````await```` for resulting value and return once awaited promise is resolved.
862
+ :param execution_context_id: *(Optional)* Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
863
+ :param object_group: *(Optional)* Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.
864
+ :param throw_on_side_effect: **(EXPERIMENTAL)** *(Optional)* Whether to throw an exception if side effect cannot be ruled out during evaluation.
865
+ :param unique_context_id: **(EXPERIMENTAL)** *(Optional)* An alternative way to specify the execution context to call function on. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental function call in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive with ````executionContextId````.
866
+ :param serialization_options: **(EXPERIMENTAL)** *(Optional)* Specifies the result serialization. If provided, overrides ````generatePreview```` and ````returnByValue```.
867
+ :returns: A tuple with the following items:
868
+
869
+ 0. **result** - Call result.
870
+ 1. **exceptionDetails** - *(Optional)* Exception details.
871
+ '''
872
+ params: T_JSON_DICT = dict()
873
+ params['functionDeclaration'] = function_declaration
874
+ if object_id is not None:
875
+ params['objectId'] = object_id.to_json()
876
+ if arguments is not None:
877
+ params['arguments'] = [i.to_json() for i in arguments]
878
+ if silent is not None:
879
+ params['silent'] = silent
880
+ if return_by_value is not None:
881
+ params['returnByValue'] = return_by_value
882
+ if generate_preview is not None:
883
+ params['generatePreview'] = generate_preview
884
+ if user_gesture is not None:
885
+ params['userGesture'] = user_gesture
886
+ if await_promise is not None:
887
+ params['awaitPromise'] = await_promise
888
+ if execution_context_id is not None:
889
+ params['executionContextId'] = execution_context_id.to_json()
890
+ if object_group is not None:
891
+ params['objectGroup'] = object_group
892
+ if throw_on_side_effect is not None:
893
+ params['throwOnSideEffect'] = throw_on_side_effect
894
+ if unique_context_id is not None:
895
+ params['uniqueContextId'] = unique_context_id
896
+ if serialization_options is not None:
897
+ params['serializationOptions'] = serialization_options.to_json()
898
+ cmd_dict: T_JSON_DICT = {
899
+ 'method': 'Runtime.callFunctionOn',
900
+ 'params': params,
901
+ }
902
+ json = yield cmd_dict
903
+ return (
904
+ RemoteObject.from_json(json['result']),
905
+ ExceptionDetails.from_json(json['exceptionDetails']) if json.get('exceptionDetails', None) is not None else None
906
+ )
907
+
908
+
909
+ def compile_script(
910
+ expression: str,
911
+ source_url: str,
912
+ persist_script: bool,
913
+ execution_context_id: typing.Optional[ExecutionContextId] = None
914
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[ScriptId], typing.Optional[ExceptionDetails]]]:
915
+ '''
916
+ Compiles expression.
917
+
918
+ :param expression: Expression to compile.
919
+ :param source_url: Source url to be set for the script.
920
+ :param persist_script: Specifies whether the compiled script should be persisted.
921
+ :param execution_context_id: *(Optional)* Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
922
+ :returns: A tuple with the following items:
923
+
924
+ 0. **scriptId** - *(Optional)* Id of the script.
925
+ 1. **exceptionDetails** - *(Optional)* Exception details.
926
+ '''
927
+ params: T_JSON_DICT = dict()
928
+ params['expression'] = expression
929
+ params['sourceURL'] = source_url
930
+ params['persistScript'] = persist_script
931
+ if execution_context_id is not None:
932
+ params['executionContextId'] = execution_context_id.to_json()
933
+ cmd_dict: T_JSON_DICT = {
934
+ 'method': 'Runtime.compileScript',
935
+ 'params': params,
936
+ }
937
+ json = yield cmd_dict
938
+ return (
939
+ ScriptId.from_json(json['scriptId']) if json.get('scriptId', None) is not None else None,
940
+ ExceptionDetails.from_json(json['exceptionDetails']) if json.get('exceptionDetails', None) is not None else None
941
+ )
942
+
943
+
944
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
945
+ '''
946
+ Disables reporting of execution contexts creation.
947
+ '''
948
+ cmd_dict: T_JSON_DICT = {
949
+ 'method': 'Runtime.disable',
950
+ }
951
+ json = yield cmd_dict
952
+
953
+
954
+ def discard_console_entries() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
955
+ '''
956
+ Discards collected exceptions and console API calls.
957
+ '''
958
+ cmd_dict: T_JSON_DICT = {
959
+ 'method': 'Runtime.discardConsoleEntries',
960
+ }
961
+ json = yield cmd_dict
962
+
963
+
964
+ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
965
+ '''
966
+ Enables reporting of execution contexts creation by means of ``executionContextCreated`` event.
967
+ When the reporting gets enabled the event will be sent immediately for each existing execution
968
+ context.
969
+ '''
970
+ cmd_dict: T_JSON_DICT = {
971
+ 'method': 'Runtime.enable',
972
+ }
973
+ json = yield cmd_dict
974
+
975
+
976
+ def evaluate(
977
+ expression: str,
978
+ object_group: typing.Optional[str] = None,
979
+ include_command_line_api: typing.Optional[bool] = None,
980
+ silent: typing.Optional[bool] = None,
981
+ context_id: typing.Optional[ExecutionContextId] = None,
982
+ return_by_value: typing.Optional[bool] = None,
983
+ generate_preview: typing.Optional[bool] = None,
984
+ user_gesture: typing.Optional[bool] = None,
985
+ await_promise: typing.Optional[bool] = None,
986
+ throw_on_side_effect: typing.Optional[bool] = None,
987
+ timeout: typing.Optional[TimeDelta] = None,
988
+ disable_breaks: typing.Optional[bool] = None,
989
+ repl_mode: typing.Optional[bool] = None,
990
+ allow_unsafe_eval_blocked_by_csp: typing.Optional[bool] = None,
991
+ unique_context_id: typing.Optional[str] = None,
992
+ serialization_options: typing.Optional[SerializationOptions] = None
993
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[RemoteObject, typing.Optional[ExceptionDetails]]]:
994
+ '''
995
+ Evaluates expression on global object.
996
+
997
+ :param expression: Expression to evaluate.
998
+ :param object_group: *(Optional)* Symbolic group name that can be used to release multiple objects.
999
+ :param include_command_line_api: *(Optional)* Determines whether Command Line API should be available during the evaluation.
1000
+ :param silent: *(Optional)* In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides ```setPauseOnException```` state.
1001
+ :param context_id: *(Optional)* Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. This is mutually exclusive with ````uniqueContextId````, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment.
1002
+ :param return_by_value: *(Optional)* Whether the result is expected to be a JSON object that should be sent by value.
1003
+ :param generate_preview: **(EXPERIMENTAL)** *(Optional)* Whether preview should be generated for the result.
1004
+ :param user_gesture: *(Optional)* Whether execution should be treated as initiated by user in the UI.
1005
+ :param await_promise: *(Optional)* Whether execution should ````await```` for resulting value and return once awaited promise is resolved.
1006
+ :param throw_on_side_effect: **(EXPERIMENTAL)** *(Optional)* Whether to throw an exception if side effect cannot be ruled out during evaluation. This implies ````disableBreaks```` below.
1007
+ :param timeout: **(EXPERIMENTAL)** *(Optional)* Terminate execution after timing out (number of milliseconds).
1008
+ :param disable_breaks: **(EXPERIMENTAL)** *(Optional)* Disable breakpoints during execution.
1009
+ :param repl_mode: **(EXPERIMENTAL)** *(Optional)* Setting this flag to true enables ````let```` re-declaration and top-level ````await````. Note that ````let```` variables can only be re-declared if they originate from ````replMode```` themselves.
1010
+ :param allow_unsafe_eval_blocked_by_csp: **(EXPERIMENTAL)** *(Optional)* The Content Security Policy (CSP) for the target might block 'unsafe-eval' which includes eval(), Function(), setTimeout() and setInterval() when called with non-callable arguments. This flag bypasses CSP for this evaluation and allows unsafe-eval. Defaults to true.
1011
+ :param unique_context_id: **(EXPERIMENTAL)** *(Optional)* An alternative way to specify the execution context to evaluate in. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental evaluation of the expression in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive with ````contextId````.
1012
+ :param serialization_options: **(EXPERIMENTAL)** *(Optional)* Specifies the result serialization. If provided, overrides ````generatePreview```` and ````returnByValue```.
1013
+ :returns: A tuple with the following items:
1014
+
1015
+ 0. **result** - Evaluation result.
1016
+ 1. **exceptionDetails** - *(Optional)* Exception details.
1017
+ '''
1018
+ params: T_JSON_DICT = dict()
1019
+ params['expression'] = expression
1020
+ if object_group is not None:
1021
+ params['objectGroup'] = object_group
1022
+ if include_command_line_api is not None:
1023
+ params['includeCommandLineAPI'] = include_command_line_api
1024
+ if silent is not None:
1025
+ params['silent'] = silent
1026
+ if context_id is not None:
1027
+ params['contextId'] = context_id.to_json()
1028
+ if return_by_value is not None:
1029
+ params['returnByValue'] = return_by_value
1030
+ if generate_preview is not None:
1031
+ params['generatePreview'] = generate_preview
1032
+ if user_gesture is not None:
1033
+ params['userGesture'] = user_gesture
1034
+ if await_promise is not None:
1035
+ params['awaitPromise'] = await_promise
1036
+ if throw_on_side_effect is not None:
1037
+ params['throwOnSideEffect'] = throw_on_side_effect
1038
+ if timeout is not None:
1039
+ params['timeout'] = timeout.to_json()
1040
+ if disable_breaks is not None:
1041
+ params['disableBreaks'] = disable_breaks
1042
+ if repl_mode is not None:
1043
+ params['replMode'] = repl_mode
1044
+ if allow_unsafe_eval_blocked_by_csp is not None:
1045
+ params['allowUnsafeEvalBlockedByCSP'] = allow_unsafe_eval_blocked_by_csp
1046
+ if unique_context_id is not None:
1047
+ params['uniqueContextId'] = unique_context_id
1048
+ if serialization_options is not None:
1049
+ params['serializationOptions'] = serialization_options.to_json()
1050
+ cmd_dict: T_JSON_DICT = {
1051
+ 'method': 'Runtime.evaluate',
1052
+ 'params': params,
1053
+ }
1054
+ json = yield cmd_dict
1055
+ return (
1056
+ RemoteObject.from_json(json['result']),
1057
+ ExceptionDetails.from_json(json['exceptionDetails']) if json.get('exceptionDetails', None) is not None else None
1058
+ )
1059
+
1060
+
1061
+ def get_isolate_id() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]:
1062
+ '''
1063
+ Returns the isolate id.
1064
+
1065
+ **EXPERIMENTAL**
1066
+
1067
+ :returns: The isolate id.
1068
+ '''
1069
+ cmd_dict: T_JSON_DICT = {
1070
+ 'method': 'Runtime.getIsolateId',
1071
+ }
1072
+ json = yield cmd_dict
1073
+ return str(json['id'])
1074
+
1075
+
1076
+ def get_heap_usage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[float, float, float, float]]:
1077
+ '''
1078
+ Returns the JavaScript heap usage.
1079
+ It is the total usage of the corresponding isolate not scoped to a particular Runtime.
1080
+
1081
+ **EXPERIMENTAL**
1082
+
1083
+ :returns: A tuple with the following items:
1084
+
1085
+ 0. **usedSize** - Used JavaScript heap size in bytes.
1086
+ 1. **totalSize** - Allocated JavaScript heap size in bytes.
1087
+ 2. **embedderHeapUsedSize** - Used size in bytes in the embedder's garbage-collected heap.
1088
+ 3. **backingStorageSize** - Size in bytes of backing storage for array buffers and external strings.
1089
+ '''
1090
+ cmd_dict: T_JSON_DICT = {
1091
+ 'method': 'Runtime.getHeapUsage',
1092
+ }
1093
+ json = yield cmd_dict
1094
+ return (
1095
+ float(json['usedSize']),
1096
+ float(json['totalSize']),
1097
+ float(json['embedderHeapUsedSize']),
1098
+ float(json['backingStorageSize'])
1099
+ )
1100
+
1101
+
1102
+ def get_properties(
1103
+ object_id: RemoteObjectId,
1104
+ own_properties: typing.Optional[bool] = None,
1105
+ accessor_properties_only: typing.Optional[bool] = None,
1106
+ generate_preview: typing.Optional[bool] = None,
1107
+ non_indexed_properties_only: typing.Optional[bool] = None
1108
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[PropertyDescriptor], typing.Optional[typing.List[InternalPropertyDescriptor]], typing.Optional[typing.List[PrivatePropertyDescriptor]], typing.Optional[ExceptionDetails]]]:
1109
+ '''
1110
+ Returns properties of a given object. Object group of the result is inherited from the target
1111
+ object.
1112
+
1113
+ :param object_id: Identifier of the object to return properties for.
1114
+ :param own_properties: *(Optional)* If true, returns properties belonging only to the element itself, not to its prototype chain.
1115
+ :param accessor_properties_only: **(EXPERIMENTAL)** *(Optional)* If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
1116
+ :param generate_preview: **(EXPERIMENTAL)** *(Optional)* Whether preview should be generated for the results.
1117
+ :param non_indexed_properties_only: **(EXPERIMENTAL)** *(Optional)* If true, returns non-indexed properties only.
1118
+ :returns: A tuple with the following items:
1119
+
1120
+ 0. **result** - Object properties.
1121
+ 1. **internalProperties** - *(Optional)* Internal object properties (only of the element itself).
1122
+ 2. **privateProperties** - *(Optional)* Object private properties.
1123
+ 3. **exceptionDetails** - *(Optional)* Exception details.
1124
+ '''
1125
+ params: T_JSON_DICT = dict()
1126
+ params['objectId'] = object_id.to_json()
1127
+ if own_properties is not None:
1128
+ params['ownProperties'] = own_properties
1129
+ if accessor_properties_only is not None:
1130
+ params['accessorPropertiesOnly'] = accessor_properties_only
1131
+ if generate_preview is not None:
1132
+ params['generatePreview'] = generate_preview
1133
+ if non_indexed_properties_only is not None:
1134
+ params['nonIndexedPropertiesOnly'] = non_indexed_properties_only
1135
+ cmd_dict: T_JSON_DICT = {
1136
+ 'method': 'Runtime.getProperties',
1137
+ 'params': params,
1138
+ }
1139
+ json = yield cmd_dict
1140
+ return (
1141
+ [PropertyDescriptor.from_json(i) for i in json['result']],
1142
+ [InternalPropertyDescriptor.from_json(i) for i in json['internalProperties']] if json.get('internalProperties', None) is not None else None,
1143
+ [PrivatePropertyDescriptor.from_json(i) for i in json['privateProperties']] if json.get('privateProperties', None) is not None else None,
1144
+ ExceptionDetails.from_json(json['exceptionDetails']) if json.get('exceptionDetails', None) is not None else None
1145
+ )
1146
+
1147
+
1148
+ def global_lexical_scope_names(
1149
+ execution_context_id: typing.Optional[ExecutionContextId] = None
1150
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]:
1151
+ '''
1152
+ Returns all let, const and class variables from global scope.
1153
+
1154
+ :param execution_context_id: *(Optional)* Specifies in which execution context to lookup global scope variables.
1155
+ :returns:
1156
+ '''
1157
+ params: T_JSON_DICT = dict()
1158
+ if execution_context_id is not None:
1159
+ params['executionContextId'] = execution_context_id.to_json()
1160
+ cmd_dict: T_JSON_DICT = {
1161
+ 'method': 'Runtime.globalLexicalScopeNames',
1162
+ 'params': params,
1163
+ }
1164
+ json = yield cmd_dict
1165
+ return [str(i) for i in json['names']]
1166
+
1167
+
1168
+ def query_objects(
1169
+ prototype_object_id: RemoteObjectId,
1170
+ object_group: typing.Optional[str] = None
1171
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,RemoteObject]:
1172
+ '''
1173
+ :param prototype_object_id: Identifier of the prototype to return objects for.
1174
+ :param object_group: *(Optional)* Symbolic group name that can be used to release the results.
1175
+ :returns: Array with objects.
1176
+ '''
1177
+ params: T_JSON_DICT = dict()
1178
+ params['prototypeObjectId'] = prototype_object_id.to_json()
1179
+ if object_group is not None:
1180
+ params['objectGroup'] = object_group
1181
+ cmd_dict: T_JSON_DICT = {
1182
+ 'method': 'Runtime.queryObjects',
1183
+ 'params': params,
1184
+ }
1185
+ json = yield cmd_dict
1186
+ return RemoteObject.from_json(json['objects'])
1187
+
1188
+
1189
+ def release_object(
1190
+ object_id: RemoteObjectId
1191
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1192
+ '''
1193
+ Releases remote object with given id.
1194
+
1195
+ :param object_id: Identifier of the object to release.
1196
+ '''
1197
+ params: T_JSON_DICT = dict()
1198
+ params['objectId'] = object_id.to_json()
1199
+ cmd_dict: T_JSON_DICT = {
1200
+ 'method': 'Runtime.releaseObject',
1201
+ 'params': params,
1202
+ }
1203
+ json = yield cmd_dict
1204
+
1205
+
1206
+ def release_object_group(
1207
+ object_group: str
1208
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1209
+ '''
1210
+ Releases all remote objects that belong to a given group.
1211
+
1212
+ :param object_group: Symbolic object group name.
1213
+ '''
1214
+ params: T_JSON_DICT = dict()
1215
+ params['objectGroup'] = object_group
1216
+ cmd_dict: T_JSON_DICT = {
1217
+ 'method': 'Runtime.releaseObjectGroup',
1218
+ 'params': params,
1219
+ }
1220
+ json = yield cmd_dict
1221
+
1222
+
1223
+ def run_if_waiting_for_debugger() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1224
+ '''
1225
+ Tells inspected instance to run if it was waiting for debugger to attach.
1226
+ '''
1227
+ cmd_dict: T_JSON_DICT = {
1228
+ 'method': 'Runtime.runIfWaitingForDebugger',
1229
+ }
1230
+ json = yield cmd_dict
1231
+
1232
+
1233
+ def run_script(
1234
+ script_id: ScriptId,
1235
+ execution_context_id: typing.Optional[ExecutionContextId] = None,
1236
+ object_group: typing.Optional[str] = None,
1237
+ silent: typing.Optional[bool] = None,
1238
+ include_command_line_api: typing.Optional[bool] = None,
1239
+ return_by_value: typing.Optional[bool] = None,
1240
+ generate_preview: typing.Optional[bool] = None,
1241
+ await_promise: typing.Optional[bool] = None
1242
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[RemoteObject, typing.Optional[ExceptionDetails]]]:
1243
+ '''
1244
+ Runs script with given id in a given context.
1245
+
1246
+ :param script_id: Id of the script to run.
1247
+ :param execution_context_id: *(Optional)* Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
1248
+ :param object_group: *(Optional)* Symbolic group name that can be used to release multiple objects.
1249
+ :param silent: *(Optional)* In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides ```setPauseOnException```` state.
1250
+ :param include_command_line_api: *(Optional)* Determines whether Command Line API should be available during the evaluation.
1251
+ :param return_by_value: *(Optional)* Whether the result is expected to be a JSON object which should be sent by value.
1252
+ :param generate_preview: *(Optional)* Whether preview should be generated for the result.
1253
+ :param await_promise: *(Optional)* Whether execution should ````await``` for resulting value and return once awaited promise is resolved.
1254
+ :returns: A tuple with the following items:
1255
+
1256
+ 0. **result** - Run result.
1257
+ 1. **exceptionDetails** - *(Optional)* Exception details.
1258
+ '''
1259
+ params: T_JSON_DICT = dict()
1260
+ params['scriptId'] = script_id.to_json()
1261
+ if execution_context_id is not None:
1262
+ params['executionContextId'] = execution_context_id.to_json()
1263
+ if object_group is not None:
1264
+ params['objectGroup'] = object_group
1265
+ if silent is not None:
1266
+ params['silent'] = silent
1267
+ if include_command_line_api is not None:
1268
+ params['includeCommandLineAPI'] = include_command_line_api
1269
+ if return_by_value is not None:
1270
+ params['returnByValue'] = return_by_value
1271
+ if generate_preview is not None:
1272
+ params['generatePreview'] = generate_preview
1273
+ if await_promise is not None:
1274
+ params['awaitPromise'] = await_promise
1275
+ cmd_dict: T_JSON_DICT = {
1276
+ 'method': 'Runtime.runScript',
1277
+ 'params': params,
1278
+ }
1279
+ json = yield cmd_dict
1280
+ return (
1281
+ RemoteObject.from_json(json['result']),
1282
+ ExceptionDetails.from_json(json['exceptionDetails']) if json.get('exceptionDetails', None) is not None else None
1283
+ )
1284
+
1285
+
1286
+ def set_async_call_stack_depth(
1287
+ max_depth: int
1288
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1289
+ '''
1290
+ Enables or disables async call stacks tracking.
1291
+
1292
+ :param max_depth: Maximum depth of async call stacks. Setting to ```0``` will effectively disable collecting async call stacks (default).
1293
+ '''
1294
+ params: T_JSON_DICT = dict()
1295
+ params['maxDepth'] = max_depth
1296
+ cmd_dict: T_JSON_DICT = {
1297
+ 'method': 'Runtime.setAsyncCallStackDepth',
1298
+ 'params': params,
1299
+ }
1300
+ json = yield cmd_dict
1301
+
1302
+
1303
+ def set_custom_object_formatter_enabled(
1304
+ enabled: bool
1305
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1306
+ '''
1307
+
1308
+
1309
+ **EXPERIMENTAL**
1310
+
1311
+ :param enabled:
1312
+ '''
1313
+ params: T_JSON_DICT = dict()
1314
+ params['enabled'] = enabled
1315
+ cmd_dict: T_JSON_DICT = {
1316
+ 'method': 'Runtime.setCustomObjectFormatterEnabled',
1317
+ 'params': params,
1318
+ }
1319
+ json = yield cmd_dict
1320
+
1321
+
1322
+ def set_max_call_stack_size_to_capture(
1323
+ size: int
1324
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1325
+ '''
1326
+
1327
+
1328
+ **EXPERIMENTAL**
1329
+
1330
+ :param size:
1331
+ '''
1332
+ params: T_JSON_DICT = dict()
1333
+ params['size'] = size
1334
+ cmd_dict: T_JSON_DICT = {
1335
+ 'method': 'Runtime.setMaxCallStackSizeToCapture',
1336
+ 'params': params,
1337
+ }
1338
+ json = yield cmd_dict
1339
+
1340
+
1341
+ def terminate_execution() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1342
+ '''
1343
+ Terminate current or next JavaScript execution.
1344
+ Will cancel the termination when the outer-most script execution ends.
1345
+
1346
+ **EXPERIMENTAL**
1347
+ '''
1348
+ cmd_dict: T_JSON_DICT = {
1349
+ 'method': 'Runtime.terminateExecution',
1350
+ }
1351
+ json = yield cmd_dict
1352
+
1353
+
1354
+ def add_binding(
1355
+ name: str,
1356
+ execution_context_id: typing.Optional[ExecutionContextId] = None,
1357
+ execution_context_name: typing.Optional[str] = None
1358
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1359
+ '''
1360
+ If executionContextId is empty, adds binding with the given name on the
1361
+ global objects of all inspected contexts, including those created later,
1362
+ bindings survive reloads.
1363
+ Binding function takes exactly one argument, this argument should be string,
1364
+ in case of any other input, function throws an exception.
1365
+ Each binding function call produces Runtime.bindingCalled notification.
1366
+
1367
+ :param name:
1368
+ :param execution_context_id: **(DEPRECATED)** **(EXPERIMENTAL)** *(Optional)* If specified, the binding would only be exposed to the specified execution context. If omitted and ```executionContextName```` is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with ````executionContextName````. Deprecated in favor of ````executionContextName```` due to an unclear use case and bugs in implementation (crbug.com/1169639). ````executionContextId```` will be removed in the future.
1369
+ :param execution_context_name: *(Optional)* If specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See also ````ExecutionContext.name```` and ````worldName```` parameter to ````Page.addScriptToEvaluateOnNewDocument````. This parameter is mutually exclusive with ````executionContextId```.
1370
+ '''
1371
+ params: T_JSON_DICT = dict()
1372
+ params['name'] = name
1373
+ if execution_context_id is not None:
1374
+ params['executionContextId'] = execution_context_id.to_json()
1375
+ if execution_context_name is not None:
1376
+ params['executionContextName'] = execution_context_name
1377
+ cmd_dict: T_JSON_DICT = {
1378
+ 'method': 'Runtime.addBinding',
1379
+ 'params': params,
1380
+ }
1381
+ json = yield cmd_dict
1382
+
1383
+
1384
+ def remove_binding(
1385
+ name: str
1386
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1387
+ '''
1388
+ This method does not remove binding function from global object but
1389
+ unsubscribes current runtime agent from Runtime.bindingCalled notifications.
1390
+
1391
+ :param name:
1392
+ '''
1393
+ params: T_JSON_DICT = dict()
1394
+ params['name'] = name
1395
+ cmd_dict: T_JSON_DICT = {
1396
+ 'method': 'Runtime.removeBinding',
1397
+ 'params': params,
1398
+ }
1399
+ json = yield cmd_dict
1400
+
1401
+
1402
+ def get_exception_details(
1403
+ error_object_id: RemoteObjectId
1404
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Optional[ExceptionDetails]]:
1405
+ '''
1406
+ This method tries to lookup and populate exception details for a
1407
+ JavaScript Error object.
1408
+ Note that the stackTrace portion of the resulting exceptionDetails will
1409
+ only be populated if the Runtime domain was enabled at the time when the
1410
+ Error was thrown.
1411
+
1412
+ **EXPERIMENTAL**
1413
+
1414
+ :param error_object_id: The error object for which to resolve the exception details.
1415
+ :returns:
1416
+ '''
1417
+ params: T_JSON_DICT = dict()
1418
+ params['errorObjectId'] = error_object_id.to_json()
1419
+ cmd_dict: T_JSON_DICT = {
1420
+ 'method': 'Runtime.getExceptionDetails',
1421
+ 'params': params,
1422
+ }
1423
+ json = yield cmd_dict
1424
+ return ExceptionDetails.from_json(json['exceptionDetails']) if json.get('exceptionDetails', None) is not None else None
1425
+
1426
+
1427
+ @event_class('Runtime.bindingCalled')
1428
+ @dataclass
1429
+ class BindingCalled:
1430
+ '''
1431
+ **EXPERIMENTAL**
1432
+
1433
+ Notification is issued every time when binding is called.
1434
+ '''
1435
+ name: str
1436
+ payload: str
1437
+ #: Identifier of the context where the call was made.
1438
+ execution_context_id: ExecutionContextId
1439
+
1440
+ @classmethod
1441
+ def from_json(cls, json: T_JSON_DICT) -> BindingCalled:
1442
+ return cls(
1443
+ name=str(json['name']),
1444
+ payload=str(json['payload']),
1445
+ execution_context_id=ExecutionContextId.from_json(json['executionContextId'])
1446
+ )
1447
+
1448
+
1449
+ @event_class('Runtime.consoleAPICalled')
1450
+ @dataclass
1451
+ class ConsoleAPICalled:
1452
+ '''
1453
+ Issued when console API was called.
1454
+ '''
1455
+ #: Type of the call.
1456
+ type_: str
1457
+ #: Call arguments.
1458
+ args: typing.List[RemoteObject]
1459
+ #: Identifier of the context where the call was made.
1460
+ execution_context_id: ExecutionContextId
1461
+ #: Call timestamp.
1462
+ timestamp: Timestamp
1463
+ #: Stack trace captured when the call was made. The async stack chain is automatically reported for
1464
+ #: the following call types: ``assert``, ``error``, ``trace``, ``warning``. For other types the async call
1465
+ #: chain can be retrieved using ``Debugger.getStackTrace`` and ``stackTrace.parentId`` field.
1466
+ stack_trace: typing.Optional[StackTrace]
1467
+ #: Console context descriptor for calls on non-default console context (not console.*):
1468
+ #: 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call
1469
+ #: on named context.
1470
+ context: typing.Optional[str]
1471
+
1472
+ @classmethod
1473
+ def from_json(cls, json: T_JSON_DICT) -> ConsoleAPICalled:
1474
+ return cls(
1475
+ type_=str(json['type']),
1476
+ args=[RemoteObject.from_json(i) for i in json['args']],
1477
+ execution_context_id=ExecutionContextId.from_json(json['executionContextId']),
1478
+ timestamp=Timestamp.from_json(json['timestamp']),
1479
+ stack_trace=StackTrace.from_json(json['stackTrace']) if json.get('stackTrace', None) is not None else None,
1480
+ context=str(json['context']) if json.get('context', None) is not None else None
1481
+ )
1482
+
1483
+
1484
+ @event_class('Runtime.exceptionRevoked')
1485
+ @dataclass
1486
+ class ExceptionRevoked:
1487
+ '''
1488
+ Issued when unhandled exception was revoked.
1489
+ '''
1490
+ #: Reason describing why exception was revoked.
1491
+ reason: str
1492
+ #: The id of revoked exception, as reported in ``exceptionThrown``.
1493
+ exception_id: int
1494
+
1495
+ @classmethod
1496
+ def from_json(cls, json: T_JSON_DICT) -> ExceptionRevoked:
1497
+ return cls(
1498
+ reason=str(json['reason']),
1499
+ exception_id=int(json['exceptionId'])
1500
+ )
1501
+
1502
+
1503
+ @event_class('Runtime.exceptionThrown')
1504
+ @dataclass
1505
+ class ExceptionThrown:
1506
+ '''
1507
+ Issued when exception was thrown and unhandled.
1508
+ '''
1509
+ #: Timestamp of the exception.
1510
+ timestamp: Timestamp
1511
+ exception_details: ExceptionDetails
1512
+
1513
+ @classmethod
1514
+ def from_json(cls, json: T_JSON_DICT) -> ExceptionThrown:
1515
+ return cls(
1516
+ timestamp=Timestamp.from_json(json['timestamp']),
1517
+ exception_details=ExceptionDetails.from_json(json['exceptionDetails'])
1518
+ )
1519
+
1520
+
1521
+ @event_class('Runtime.executionContextCreated')
1522
+ @dataclass
1523
+ class ExecutionContextCreated:
1524
+ '''
1525
+ Issued when new execution context is created.
1526
+ '''
1527
+ #: A newly created execution context.
1528
+ context: ExecutionContextDescription
1529
+
1530
+ @classmethod
1531
+ def from_json(cls, json: T_JSON_DICT) -> ExecutionContextCreated:
1532
+ return cls(
1533
+ context=ExecutionContextDescription.from_json(json['context'])
1534
+ )
1535
+
1536
+
1537
+ @event_class('Runtime.executionContextDestroyed')
1538
+ @dataclass
1539
+ class ExecutionContextDestroyed:
1540
+ '''
1541
+ Issued when execution context is destroyed.
1542
+ '''
1543
+ #: Id of the destroyed context
1544
+ execution_context_id: ExecutionContextId
1545
+ #: Unique Id of the destroyed context
1546
+ execution_context_unique_id: str
1547
+
1548
+ @classmethod
1549
+ def from_json(cls, json: T_JSON_DICT) -> ExecutionContextDestroyed:
1550
+ return cls(
1551
+ execution_context_id=ExecutionContextId.from_json(json['executionContextId']),
1552
+ execution_context_unique_id=str(json['executionContextUniqueId'])
1553
+ )
1554
+
1555
+
1556
+ @event_class('Runtime.executionContextsCleared')
1557
+ @dataclass
1558
+ class ExecutionContextsCleared:
1559
+ '''
1560
+ Issued when all executionContexts were cleared in browser
1561
+ '''
1562
+
1563
+
1564
+ @classmethod
1565
+ def from_json(cls, json: T_JSON_DICT) -> ExecutionContextsCleared:
1566
+ return cls(
1567
+
1568
+ )
1569
+
1570
+
1571
+ @event_class('Runtime.inspectRequested')
1572
+ @dataclass
1573
+ class InspectRequested:
1574
+ '''
1575
+ Issued when object should be inspected (for example, as a result of inspect() command line API
1576
+ call).
1577
+ '''
1578
+ object_: RemoteObject
1579
+ hints: dict
1580
+ #: Identifier of the context where the call was made.
1581
+ execution_context_id: typing.Optional[ExecutionContextId]
1582
+
1583
+ @classmethod
1584
+ def from_json(cls, json: T_JSON_DICT) -> InspectRequested:
1585
+ return cls(
1586
+ object_=RemoteObject.from_json(json['object']),
1587
+ hints=dict(json['hints']),
1588
+ execution_context_id=ExecutionContextId.from_json(json['executionContextId']) if json.get('executionContextId', None) is not None else None
1589
+ )