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.
- mithwire/__init__.py +32 -0
- mithwire/cdp/README.md +4 -0
- mithwire/cdp/__init__.py +6 -0
- mithwire/cdp/accessibility.py +668 -0
- mithwire/cdp/animation.py +494 -0
- mithwire/cdp/audits.py +1995 -0
- mithwire/cdp/autofill.py +292 -0
- mithwire/cdp/background_service.py +215 -0
- mithwire/cdp/bluetooth_emulation.py +626 -0
- mithwire/cdp/browser.py +821 -0
- mithwire/cdp/cache_storage.py +311 -0
- mithwire/cdp/cast.py +172 -0
- mithwire/cdp/console.py +107 -0
- mithwire/cdp/crash_report_context.py +55 -0
- mithwire/cdp/css.py +2750 -0
- mithwire/cdp/database.py +179 -0
- mithwire/cdp/debugger.py +1405 -0
- mithwire/cdp/device_access.py +141 -0
- mithwire/cdp/device_orientation.py +45 -0
- mithwire/cdp/dom.py +2257 -0
- mithwire/cdp/dom_debugger.py +321 -0
- mithwire/cdp/dom_snapshot.py +876 -0
- mithwire/cdp/dom_storage.py +222 -0
- mithwire/cdp/emulation.py +1779 -0
- mithwire/cdp/event_breakpoints.py +56 -0
- mithwire/cdp/extensions.py +238 -0
- mithwire/cdp/fed_cm.py +283 -0
- mithwire/cdp/fetch.py +507 -0
- mithwire/cdp/file_system.py +115 -0
- mithwire/cdp/headless_experimental.py +115 -0
- mithwire/cdp/heap_profiler.py +401 -0
- mithwire/cdp/indexed_db.py +528 -0
- mithwire/cdp/input_.py +701 -0
- mithwire/cdp/inspector.py +95 -0
- mithwire/cdp/io.py +101 -0
- mithwire/cdp/layer_tree.py +464 -0
- mithwire/cdp/log.py +190 -0
- mithwire/cdp/media.py +313 -0
- mithwire/cdp/memory.py +305 -0
- mithwire/cdp/network.py +5342 -0
- mithwire/cdp/overlay.py +1468 -0
- mithwire/cdp/page.py +3972 -0
- mithwire/cdp/performance.py +124 -0
- mithwire/cdp/performance_timeline.py +200 -0
- mithwire/cdp/preload.py +575 -0
- mithwire/cdp/profiler.py +420 -0
- mithwire/cdp/pwa.py +278 -0
- mithwire/cdp/py.typed +0 -0
- mithwire/cdp/runtime.py +1589 -0
- mithwire/cdp/schema.py +50 -0
- mithwire/cdp/security.py +518 -0
- mithwire/cdp/service_worker.py +401 -0
- mithwire/cdp/smart_card_emulation.py +891 -0
- mithwire/cdp/storage.py +1573 -0
- mithwire/cdp/system_info.py +327 -0
- mithwire/cdp/target.py +829 -0
- mithwire/cdp/tethering.py +65 -0
- mithwire/cdp/tracing.py +377 -0
- mithwire/cdp/util.py +18 -0
- mithwire/cdp/web_audio.py +606 -0
- mithwire/cdp/web_authn.py +598 -0
- mithwire/cdp/web_mcp.py +293 -0
- mithwire/core/_contradict.py +142 -0
- mithwire/core/browser.py +923 -0
- mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
- mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
- mithwire/core/config.py +323 -0
- mithwire/core/connection.py +564 -0
- mithwire/core/element.py +1205 -0
- mithwire/core/tab.py +2202 -0
- mithwire/core/util.py +5063 -0
- mithwire-0.50.3.dist-info/METADATA +1049 -0
- mithwire-0.50.3.dist-info/RECORD +76 -0
- mithwire-0.50.3.dist-info/WHEEL +5 -0
- mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
- mithwire-0.50.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,311 @@
|
|
|
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: CacheStorage (experimental)
|
|
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 storage
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CacheId(str):
|
|
18
|
+
'''
|
|
19
|
+
Unique identifier of the Cache object.
|
|
20
|
+
'''
|
|
21
|
+
def to_json(self) -> str:
|
|
22
|
+
return self
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def from_json(cls, json: str) -> CacheId:
|
|
26
|
+
return cls(json)
|
|
27
|
+
|
|
28
|
+
def __repr__(self):
|
|
29
|
+
return 'CacheId({})'.format(super().__repr__())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class CachedResponseType(enum.Enum):
|
|
33
|
+
'''
|
|
34
|
+
type of HTTP response cached
|
|
35
|
+
'''
|
|
36
|
+
BASIC = "basic"
|
|
37
|
+
CORS = "cors"
|
|
38
|
+
DEFAULT = "default"
|
|
39
|
+
ERROR = "error"
|
|
40
|
+
OPAQUE_RESPONSE = "opaqueResponse"
|
|
41
|
+
OPAQUE_REDIRECT = "opaqueRedirect"
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
return self.value
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def from_json(cls, json: str) -> CachedResponseType:
|
|
48
|
+
return cls(json)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass
|
|
52
|
+
class DataEntry:
|
|
53
|
+
'''
|
|
54
|
+
Data entry.
|
|
55
|
+
'''
|
|
56
|
+
#: Request URL.
|
|
57
|
+
request_url: str
|
|
58
|
+
|
|
59
|
+
#: Request method.
|
|
60
|
+
request_method: str
|
|
61
|
+
|
|
62
|
+
#: Request headers
|
|
63
|
+
request_headers: typing.List[Header]
|
|
64
|
+
|
|
65
|
+
#: Number of seconds since epoch.
|
|
66
|
+
response_time: float
|
|
67
|
+
|
|
68
|
+
#: HTTP response status code.
|
|
69
|
+
response_status: int
|
|
70
|
+
|
|
71
|
+
#: HTTP response status text.
|
|
72
|
+
response_status_text: str
|
|
73
|
+
|
|
74
|
+
#: HTTP response type
|
|
75
|
+
response_type: CachedResponseType
|
|
76
|
+
|
|
77
|
+
#: Response headers
|
|
78
|
+
response_headers: typing.List[Header]
|
|
79
|
+
|
|
80
|
+
def to_json(self) -> T_JSON_DICT:
|
|
81
|
+
json: T_JSON_DICT = dict()
|
|
82
|
+
json['requestURL'] = self.request_url
|
|
83
|
+
json['requestMethod'] = self.request_method
|
|
84
|
+
json['requestHeaders'] = [i.to_json() for i in self.request_headers]
|
|
85
|
+
json['responseTime'] = self.response_time
|
|
86
|
+
json['responseStatus'] = self.response_status
|
|
87
|
+
json['responseStatusText'] = self.response_status_text
|
|
88
|
+
json['responseType'] = self.response_type.to_json()
|
|
89
|
+
json['responseHeaders'] = [i.to_json() for i in self.response_headers]
|
|
90
|
+
return json
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_json(cls, json: T_JSON_DICT) -> DataEntry:
|
|
94
|
+
return cls(
|
|
95
|
+
request_url=str(json['requestURL']),
|
|
96
|
+
request_method=str(json['requestMethod']),
|
|
97
|
+
request_headers=[Header.from_json(i) for i in json['requestHeaders']],
|
|
98
|
+
response_time=float(json['responseTime']),
|
|
99
|
+
response_status=int(json['responseStatus']),
|
|
100
|
+
response_status_text=str(json['responseStatusText']),
|
|
101
|
+
response_type=CachedResponseType.from_json(json['responseType']),
|
|
102
|
+
response_headers=[Header.from_json(i) for i in json['responseHeaders']],
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@dataclass
|
|
107
|
+
class Cache:
|
|
108
|
+
'''
|
|
109
|
+
Cache identifier.
|
|
110
|
+
'''
|
|
111
|
+
#: An opaque unique id of the cache.
|
|
112
|
+
cache_id: CacheId
|
|
113
|
+
|
|
114
|
+
#: Security origin of the cache.
|
|
115
|
+
security_origin: str
|
|
116
|
+
|
|
117
|
+
#: Storage key of the cache.
|
|
118
|
+
storage_key: str
|
|
119
|
+
|
|
120
|
+
#: The name of the cache.
|
|
121
|
+
cache_name: str
|
|
122
|
+
|
|
123
|
+
#: Storage bucket of the cache.
|
|
124
|
+
storage_bucket: typing.Optional[storage.StorageBucket] = None
|
|
125
|
+
|
|
126
|
+
def to_json(self) -> T_JSON_DICT:
|
|
127
|
+
json: T_JSON_DICT = dict()
|
|
128
|
+
json['cacheId'] = self.cache_id.to_json()
|
|
129
|
+
json['securityOrigin'] = self.security_origin
|
|
130
|
+
json['storageKey'] = self.storage_key
|
|
131
|
+
json['cacheName'] = self.cache_name
|
|
132
|
+
if self.storage_bucket is not None:
|
|
133
|
+
json['storageBucket'] = self.storage_bucket.to_json()
|
|
134
|
+
return json
|
|
135
|
+
|
|
136
|
+
@classmethod
|
|
137
|
+
def from_json(cls, json: T_JSON_DICT) -> Cache:
|
|
138
|
+
return cls(
|
|
139
|
+
cache_id=CacheId.from_json(json['cacheId']),
|
|
140
|
+
security_origin=str(json['securityOrigin']),
|
|
141
|
+
storage_key=str(json['storageKey']),
|
|
142
|
+
cache_name=str(json['cacheName']),
|
|
143
|
+
storage_bucket=storage.StorageBucket.from_json(json['storageBucket']) if json.get('storageBucket', None) is not None else None,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@dataclass
|
|
148
|
+
class Header:
|
|
149
|
+
name: str
|
|
150
|
+
|
|
151
|
+
value: str
|
|
152
|
+
|
|
153
|
+
def to_json(self) -> T_JSON_DICT:
|
|
154
|
+
json: T_JSON_DICT = dict()
|
|
155
|
+
json['name'] = self.name
|
|
156
|
+
json['value'] = self.value
|
|
157
|
+
return json
|
|
158
|
+
|
|
159
|
+
@classmethod
|
|
160
|
+
def from_json(cls, json: T_JSON_DICT) -> Header:
|
|
161
|
+
return cls(
|
|
162
|
+
name=str(json['name']),
|
|
163
|
+
value=str(json['value']),
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@dataclass
|
|
168
|
+
class CachedResponse:
|
|
169
|
+
'''
|
|
170
|
+
Cached response
|
|
171
|
+
'''
|
|
172
|
+
#: Entry content, base64-encoded. (Encoded as a base64 string when passed over JSON)
|
|
173
|
+
body: str
|
|
174
|
+
|
|
175
|
+
def to_json(self) -> T_JSON_DICT:
|
|
176
|
+
json: T_JSON_DICT = dict()
|
|
177
|
+
json['body'] = self.body
|
|
178
|
+
return json
|
|
179
|
+
|
|
180
|
+
@classmethod
|
|
181
|
+
def from_json(cls, json: T_JSON_DICT) -> CachedResponse:
|
|
182
|
+
return cls(
|
|
183
|
+
body=str(json['body']),
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def delete_cache(
|
|
188
|
+
cache_id: CacheId
|
|
189
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
190
|
+
'''
|
|
191
|
+
Deletes a cache.
|
|
192
|
+
|
|
193
|
+
:param cache_id: Id of cache for deletion.
|
|
194
|
+
'''
|
|
195
|
+
params: T_JSON_DICT = dict()
|
|
196
|
+
params['cacheId'] = cache_id.to_json()
|
|
197
|
+
cmd_dict: T_JSON_DICT = {
|
|
198
|
+
'method': 'CacheStorage.deleteCache',
|
|
199
|
+
'params': params,
|
|
200
|
+
}
|
|
201
|
+
json = yield cmd_dict
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def delete_entry(
|
|
205
|
+
cache_id: CacheId,
|
|
206
|
+
request: str
|
|
207
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
208
|
+
'''
|
|
209
|
+
Deletes a cache entry.
|
|
210
|
+
|
|
211
|
+
:param cache_id: Id of cache where the entry will be deleted.
|
|
212
|
+
:param request: URL spec of the request.
|
|
213
|
+
'''
|
|
214
|
+
params: T_JSON_DICT = dict()
|
|
215
|
+
params['cacheId'] = cache_id.to_json()
|
|
216
|
+
params['request'] = request
|
|
217
|
+
cmd_dict: T_JSON_DICT = {
|
|
218
|
+
'method': 'CacheStorage.deleteEntry',
|
|
219
|
+
'params': params,
|
|
220
|
+
}
|
|
221
|
+
json = yield cmd_dict
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def request_cache_names(
|
|
225
|
+
security_origin: typing.Optional[str] = None,
|
|
226
|
+
storage_key: typing.Optional[str] = None,
|
|
227
|
+
storage_bucket: typing.Optional[storage.StorageBucket] = None
|
|
228
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Cache]]:
|
|
229
|
+
'''
|
|
230
|
+
Requests cache names.
|
|
231
|
+
|
|
232
|
+
:param security_origin: *(Optional)* At least and at most one of securityOrigin, storageKey, storageBucket must be specified. Security origin.
|
|
233
|
+
:param storage_key: *(Optional)* Storage key.
|
|
234
|
+
:param storage_bucket: *(Optional)* Storage bucket. If not specified, it uses the default bucket.
|
|
235
|
+
:returns: Caches for the security origin.
|
|
236
|
+
'''
|
|
237
|
+
params: T_JSON_DICT = dict()
|
|
238
|
+
if security_origin is not None:
|
|
239
|
+
params['securityOrigin'] = security_origin
|
|
240
|
+
if storage_key is not None:
|
|
241
|
+
params['storageKey'] = storage_key
|
|
242
|
+
if storage_bucket is not None:
|
|
243
|
+
params['storageBucket'] = storage_bucket.to_json()
|
|
244
|
+
cmd_dict: T_JSON_DICT = {
|
|
245
|
+
'method': 'CacheStorage.requestCacheNames',
|
|
246
|
+
'params': params,
|
|
247
|
+
}
|
|
248
|
+
json = yield cmd_dict
|
|
249
|
+
return [Cache.from_json(i) for i in json['caches']]
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def request_cached_response(
|
|
253
|
+
cache_id: CacheId,
|
|
254
|
+
request_url: str,
|
|
255
|
+
request_headers: typing.List[Header]
|
|
256
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CachedResponse]:
|
|
257
|
+
'''
|
|
258
|
+
Fetches cache entry.
|
|
259
|
+
|
|
260
|
+
:param cache_id: Id of cache that contains the entry.
|
|
261
|
+
:param request_url: URL spec of the request.
|
|
262
|
+
:param request_headers: headers of the request.
|
|
263
|
+
:returns: Response read from the cache.
|
|
264
|
+
'''
|
|
265
|
+
params: T_JSON_DICT = dict()
|
|
266
|
+
params['cacheId'] = cache_id.to_json()
|
|
267
|
+
params['requestURL'] = request_url
|
|
268
|
+
params['requestHeaders'] = [i.to_json() for i in request_headers]
|
|
269
|
+
cmd_dict: T_JSON_DICT = {
|
|
270
|
+
'method': 'CacheStorage.requestCachedResponse',
|
|
271
|
+
'params': params,
|
|
272
|
+
}
|
|
273
|
+
json = yield cmd_dict
|
|
274
|
+
return CachedResponse.from_json(json['response'])
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def request_entries(
|
|
278
|
+
cache_id: CacheId,
|
|
279
|
+
skip_count: typing.Optional[int] = None,
|
|
280
|
+
page_size: typing.Optional[int] = None,
|
|
281
|
+
path_filter: typing.Optional[str] = None
|
|
282
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[DataEntry], float]]:
|
|
283
|
+
'''
|
|
284
|
+
Requests data from cache.
|
|
285
|
+
|
|
286
|
+
:param cache_id: ID of cache to get entries from.
|
|
287
|
+
:param skip_count: *(Optional)* Number of records to skip.
|
|
288
|
+
:param page_size: *(Optional)* Number of records to fetch.
|
|
289
|
+
:param path_filter: *(Optional)* If present, only return the entries containing this substring in the path
|
|
290
|
+
:returns: A tuple with the following items:
|
|
291
|
+
|
|
292
|
+
0. **cacheDataEntries** - Array of object store data entries.
|
|
293
|
+
1. **returnCount** - Count of returned entries from this storage. If pathFilter is empty, it is the count of all entries from this storage.
|
|
294
|
+
'''
|
|
295
|
+
params: T_JSON_DICT = dict()
|
|
296
|
+
params['cacheId'] = cache_id.to_json()
|
|
297
|
+
if skip_count is not None:
|
|
298
|
+
params['skipCount'] = skip_count
|
|
299
|
+
if page_size is not None:
|
|
300
|
+
params['pageSize'] = page_size
|
|
301
|
+
if path_filter is not None:
|
|
302
|
+
params['pathFilter'] = path_filter
|
|
303
|
+
cmd_dict: T_JSON_DICT = {
|
|
304
|
+
'method': 'CacheStorage.requestEntries',
|
|
305
|
+
'params': params,
|
|
306
|
+
}
|
|
307
|
+
json = yield cmd_dict
|
|
308
|
+
return (
|
|
309
|
+
[DataEntry.from_json(i) for i in json['cacheDataEntries']],
|
|
310
|
+
float(json['returnCount'])
|
|
311
|
+
)
|
mithwire/cdp/cast.py
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
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: Cast (experimental)
|
|
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
|
+
@dataclass
|
|
16
|
+
class Sink:
|
|
17
|
+
name: str
|
|
18
|
+
|
|
19
|
+
id_: str
|
|
20
|
+
|
|
21
|
+
#: Text describing the current session. Present only if there is an active
|
|
22
|
+
#: session on the sink.
|
|
23
|
+
session: typing.Optional[str] = None
|
|
24
|
+
|
|
25
|
+
def to_json(self) -> T_JSON_DICT:
|
|
26
|
+
json: T_JSON_DICT = dict()
|
|
27
|
+
json['name'] = self.name
|
|
28
|
+
json['id'] = self.id_
|
|
29
|
+
if self.session is not None:
|
|
30
|
+
json['session'] = self.session
|
|
31
|
+
return json
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_json(cls, json: T_JSON_DICT) -> Sink:
|
|
35
|
+
return cls(
|
|
36
|
+
name=str(json['name']),
|
|
37
|
+
id_=str(json['id']),
|
|
38
|
+
session=str(json['session']) if json.get('session', None) is not None else None,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def enable(
|
|
43
|
+
presentation_url: typing.Optional[str] = None
|
|
44
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
45
|
+
'''
|
|
46
|
+
Starts observing for sinks that can be used for tab mirroring, and if set,
|
|
47
|
+
sinks compatible with ``presentationUrl`` as well. When sinks are found, a
|
|
48
|
+
``sinksUpdated`` event is fired.
|
|
49
|
+
Also starts observing for issue messages. When an issue is added or removed,
|
|
50
|
+
an ``issueUpdated`` event is fired.
|
|
51
|
+
|
|
52
|
+
:param presentation_url: *(Optional)*
|
|
53
|
+
'''
|
|
54
|
+
params: T_JSON_DICT = dict()
|
|
55
|
+
if presentation_url is not None:
|
|
56
|
+
params['presentationUrl'] = presentation_url
|
|
57
|
+
cmd_dict: T_JSON_DICT = {
|
|
58
|
+
'method': 'Cast.enable',
|
|
59
|
+
'params': params,
|
|
60
|
+
}
|
|
61
|
+
json = yield cmd_dict
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
65
|
+
'''
|
|
66
|
+
Stops observing for sinks and issues.
|
|
67
|
+
'''
|
|
68
|
+
cmd_dict: T_JSON_DICT = {
|
|
69
|
+
'method': 'Cast.disable',
|
|
70
|
+
}
|
|
71
|
+
json = yield cmd_dict
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def set_sink_to_use(
|
|
75
|
+
sink_name: str
|
|
76
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
77
|
+
'''
|
|
78
|
+
Sets a sink to be used when the web page requests the browser to choose a
|
|
79
|
+
sink via Presentation API, Remote Playback API, or Cast SDK.
|
|
80
|
+
|
|
81
|
+
:param sink_name:
|
|
82
|
+
'''
|
|
83
|
+
params: T_JSON_DICT = dict()
|
|
84
|
+
params['sinkName'] = sink_name
|
|
85
|
+
cmd_dict: T_JSON_DICT = {
|
|
86
|
+
'method': 'Cast.setSinkToUse',
|
|
87
|
+
'params': params,
|
|
88
|
+
}
|
|
89
|
+
json = yield cmd_dict
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def start_desktop_mirroring(
|
|
93
|
+
sink_name: str
|
|
94
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
95
|
+
'''
|
|
96
|
+
Starts mirroring the desktop to the sink.
|
|
97
|
+
|
|
98
|
+
:param sink_name:
|
|
99
|
+
'''
|
|
100
|
+
params: T_JSON_DICT = dict()
|
|
101
|
+
params['sinkName'] = sink_name
|
|
102
|
+
cmd_dict: T_JSON_DICT = {
|
|
103
|
+
'method': 'Cast.startDesktopMirroring',
|
|
104
|
+
'params': params,
|
|
105
|
+
}
|
|
106
|
+
json = yield cmd_dict
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def start_tab_mirroring(
|
|
110
|
+
sink_name: str
|
|
111
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
112
|
+
'''
|
|
113
|
+
Starts mirroring the tab to the sink.
|
|
114
|
+
|
|
115
|
+
:param sink_name:
|
|
116
|
+
'''
|
|
117
|
+
params: T_JSON_DICT = dict()
|
|
118
|
+
params['sinkName'] = sink_name
|
|
119
|
+
cmd_dict: T_JSON_DICT = {
|
|
120
|
+
'method': 'Cast.startTabMirroring',
|
|
121
|
+
'params': params,
|
|
122
|
+
}
|
|
123
|
+
json = yield cmd_dict
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def stop_casting(
|
|
127
|
+
sink_name: str
|
|
128
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
129
|
+
'''
|
|
130
|
+
Stops the active Cast session on the sink.
|
|
131
|
+
|
|
132
|
+
:param sink_name:
|
|
133
|
+
'''
|
|
134
|
+
params: T_JSON_DICT = dict()
|
|
135
|
+
params['sinkName'] = sink_name
|
|
136
|
+
cmd_dict: T_JSON_DICT = {
|
|
137
|
+
'method': 'Cast.stopCasting',
|
|
138
|
+
'params': params,
|
|
139
|
+
}
|
|
140
|
+
json = yield cmd_dict
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@event_class('Cast.sinksUpdated')
|
|
144
|
+
@dataclass
|
|
145
|
+
class SinksUpdated:
|
|
146
|
+
'''
|
|
147
|
+
This is fired whenever the list of available sinks changes. A sink is a
|
|
148
|
+
device or a software surface that you can cast to.
|
|
149
|
+
'''
|
|
150
|
+
sinks: typing.List[Sink]
|
|
151
|
+
|
|
152
|
+
@classmethod
|
|
153
|
+
def from_json(cls, json: T_JSON_DICT) -> SinksUpdated:
|
|
154
|
+
return cls(
|
|
155
|
+
sinks=[Sink.from_json(i) for i in json['sinks']]
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
@event_class('Cast.issueUpdated')
|
|
160
|
+
@dataclass
|
|
161
|
+
class IssueUpdated:
|
|
162
|
+
'''
|
|
163
|
+
This is fired whenever the outstanding issue/error message changes.
|
|
164
|
+
``issueMessage`` is empty if there is no issue.
|
|
165
|
+
'''
|
|
166
|
+
issue_message: str
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def from_json(cls, json: T_JSON_DICT) -> IssueUpdated:
|
|
170
|
+
return cls(
|
|
171
|
+
issue_message=str(json['issueMessage'])
|
|
172
|
+
)
|
mithwire/cdp/console.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
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: Console
|
|
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
|
+
@dataclass
|
|
16
|
+
class ConsoleMessage:
|
|
17
|
+
'''
|
|
18
|
+
Console message.
|
|
19
|
+
'''
|
|
20
|
+
#: Message source.
|
|
21
|
+
source: str
|
|
22
|
+
|
|
23
|
+
#: Message severity.
|
|
24
|
+
level: str
|
|
25
|
+
|
|
26
|
+
#: Message text.
|
|
27
|
+
text: str
|
|
28
|
+
|
|
29
|
+
#: URL of the message origin.
|
|
30
|
+
url: typing.Optional[str] = None
|
|
31
|
+
|
|
32
|
+
#: Line number in the resource that generated this message (1-based).
|
|
33
|
+
line: typing.Optional[int] = None
|
|
34
|
+
|
|
35
|
+
#: Column number in the resource that generated this message (1-based).
|
|
36
|
+
column: typing.Optional[int] = None
|
|
37
|
+
|
|
38
|
+
def to_json(self) -> T_JSON_DICT:
|
|
39
|
+
json: T_JSON_DICT = dict()
|
|
40
|
+
json['source'] = self.source
|
|
41
|
+
json['level'] = self.level
|
|
42
|
+
json['text'] = self.text
|
|
43
|
+
if self.url is not None:
|
|
44
|
+
json['url'] = self.url
|
|
45
|
+
if self.line is not None:
|
|
46
|
+
json['line'] = self.line
|
|
47
|
+
if self.column is not None:
|
|
48
|
+
json['column'] = self.column
|
|
49
|
+
return json
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json: T_JSON_DICT) -> ConsoleMessage:
|
|
53
|
+
return cls(
|
|
54
|
+
source=str(json['source']),
|
|
55
|
+
level=str(json['level']),
|
|
56
|
+
text=str(json['text']),
|
|
57
|
+
url=str(json['url']) if json.get('url', None) is not None else None,
|
|
58
|
+
line=int(json['line']) if json.get('line', None) is not None else None,
|
|
59
|
+
column=int(json['column']) if json.get('column', None) is not None else None,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def clear_messages() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
64
|
+
'''
|
|
65
|
+
Does nothing.
|
|
66
|
+
'''
|
|
67
|
+
cmd_dict: T_JSON_DICT = {
|
|
68
|
+
'method': 'Console.clearMessages',
|
|
69
|
+
}
|
|
70
|
+
json = yield cmd_dict
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
74
|
+
'''
|
|
75
|
+
Disables console domain, prevents further console messages from being reported to the client.
|
|
76
|
+
'''
|
|
77
|
+
cmd_dict: T_JSON_DICT = {
|
|
78
|
+
'method': 'Console.disable',
|
|
79
|
+
}
|
|
80
|
+
json = yield cmd_dict
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
84
|
+
'''
|
|
85
|
+
Enables console domain, sends the messages collected so far to the client by means of the
|
|
86
|
+
``messageAdded`` notification.
|
|
87
|
+
'''
|
|
88
|
+
cmd_dict: T_JSON_DICT = {
|
|
89
|
+
'method': 'Console.enable',
|
|
90
|
+
}
|
|
91
|
+
json = yield cmd_dict
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@event_class('Console.messageAdded')
|
|
95
|
+
@dataclass
|
|
96
|
+
class MessageAdded:
|
|
97
|
+
'''
|
|
98
|
+
Issued when new console message is added.
|
|
99
|
+
'''
|
|
100
|
+
#: Console message that has been added.
|
|
101
|
+
message: ConsoleMessage
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def from_json(cls, json: T_JSON_DICT) -> MessageAdded:
|
|
105
|
+
return cls(
|
|
106
|
+
message=ConsoleMessage.from_json(json['message'])
|
|
107
|
+
)
|
|
@@ -0,0 +1,55 @@
|
|
|
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: CrashReportContext (experimental)
|
|
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 page
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class CrashReportContextEntry:
|
|
19
|
+
'''
|
|
20
|
+
Key-value pair in CrashReportContext.
|
|
21
|
+
'''
|
|
22
|
+
key: str
|
|
23
|
+
|
|
24
|
+
value: str
|
|
25
|
+
|
|
26
|
+
#: The ID of the frame where the key-value pair was set.
|
|
27
|
+
frame_id: page.FrameId
|
|
28
|
+
|
|
29
|
+
def to_json(self) -> T_JSON_DICT:
|
|
30
|
+
json: T_JSON_DICT = dict()
|
|
31
|
+
json['key'] = self.key
|
|
32
|
+
json['value'] = self.value
|
|
33
|
+
json['frameId'] = self.frame_id.to_json()
|
|
34
|
+
return json
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_json(cls, json: T_JSON_DICT) -> CrashReportContextEntry:
|
|
38
|
+
return cls(
|
|
39
|
+
key=str(json['key']),
|
|
40
|
+
value=str(json['value']),
|
|
41
|
+
frame_id=page.FrameId.from_json(json['frameId']),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_entries() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[CrashReportContextEntry]]:
|
|
46
|
+
'''
|
|
47
|
+
Returns all entries in the CrashReportContext across all frames in the page.
|
|
48
|
+
|
|
49
|
+
:returns:
|
|
50
|
+
'''
|
|
51
|
+
cmd_dict: T_JSON_DICT = {
|
|
52
|
+
'method': 'CrashReportContext.getEntries',
|
|
53
|
+
}
|
|
54
|
+
json = yield cmd_dict
|
|
55
|
+
return [CrashReportContextEntry.from_json(i) for i in json['entries']]
|