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,292 @@
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: Autofill (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 dom
15
+ from . import page
16
+
17
+
18
+ @dataclass
19
+ class CreditCard:
20
+ #: 16-digit credit card number.
21
+ number: str
22
+
23
+ #: Name of the credit card owner.
24
+ name: str
25
+
26
+ #: 2-digit expiry month.
27
+ expiry_month: str
28
+
29
+ #: 4-digit expiry year.
30
+ expiry_year: str
31
+
32
+ #: 3-digit card verification code.
33
+ cvc: str
34
+
35
+ def to_json(self) -> T_JSON_DICT:
36
+ json: T_JSON_DICT = dict()
37
+ json['number'] = self.number
38
+ json['name'] = self.name
39
+ json['expiryMonth'] = self.expiry_month
40
+ json['expiryYear'] = self.expiry_year
41
+ json['cvc'] = self.cvc
42
+ return json
43
+
44
+ @classmethod
45
+ def from_json(cls, json: T_JSON_DICT) -> CreditCard:
46
+ return cls(
47
+ number=str(json['number']),
48
+ name=str(json['name']),
49
+ expiry_month=str(json['expiryMonth']),
50
+ expiry_year=str(json['expiryYear']),
51
+ cvc=str(json['cvc']),
52
+ )
53
+
54
+
55
+ @dataclass
56
+ class AddressField:
57
+ #: address field name, for example GIVEN_NAME.
58
+ #: The full list of supported field names:
59
+ #: https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/core/browser/field_types.cc;l=38
60
+ name: str
61
+
62
+ #: address field value, for example Jon Doe.
63
+ value: str
64
+
65
+ def to_json(self) -> T_JSON_DICT:
66
+ json: T_JSON_DICT = dict()
67
+ json['name'] = self.name
68
+ json['value'] = self.value
69
+ return json
70
+
71
+ @classmethod
72
+ def from_json(cls, json: T_JSON_DICT) -> AddressField:
73
+ return cls(
74
+ name=str(json['name']),
75
+ value=str(json['value']),
76
+ )
77
+
78
+
79
+ @dataclass
80
+ class AddressFields:
81
+ '''
82
+ A list of address fields.
83
+ '''
84
+ fields: typing.List[AddressField]
85
+
86
+ def to_json(self) -> T_JSON_DICT:
87
+ json: T_JSON_DICT = dict()
88
+ json['fields'] = [i.to_json() for i in self.fields]
89
+ return json
90
+
91
+ @classmethod
92
+ def from_json(cls, json: T_JSON_DICT) -> AddressFields:
93
+ return cls(
94
+ fields=[AddressField.from_json(i) for i in json['fields']],
95
+ )
96
+
97
+
98
+ @dataclass
99
+ class Address:
100
+ #: fields and values defining an address.
101
+ fields: typing.List[AddressField]
102
+
103
+ def to_json(self) -> T_JSON_DICT:
104
+ json: T_JSON_DICT = dict()
105
+ json['fields'] = [i.to_json() for i in self.fields]
106
+ return json
107
+
108
+ @classmethod
109
+ def from_json(cls, json: T_JSON_DICT) -> Address:
110
+ return cls(
111
+ fields=[AddressField.from_json(i) for i in json['fields']],
112
+ )
113
+
114
+
115
+ @dataclass
116
+ class AddressUI:
117
+ '''
118
+ Defines how an address can be displayed like in chrome://settings/addresses.
119
+ Address UI is a two dimensional array, each inner array is an "address information line", and when rendered in a UI surface should be displayed as such.
120
+ The following address UI for instance:
121
+ [[{name: "GIVE_NAME", value: "Jon"}, {name: "FAMILY_NAME", value: "Doe"}], [{name: "CITY", value: "Munich"}, {name: "ZIP", value: "81456"}]]
122
+ should allow the receiver to render:
123
+ Jon Doe
124
+ Munich 81456
125
+ '''
126
+ #: A two dimension array containing the representation of values from an address profile.
127
+ address_fields: typing.List[AddressFields]
128
+
129
+ def to_json(self) -> T_JSON_DICT:
130
+ json: T_JSON_DICT = dict()
131
+ json['addressFields'] = [i.to_json() for i in self.address_fields]
132
+ return json
133
+
134
+ @classmethod
135
+ def from_json(cls, json: T_JSON_DICT) -> AddressUI:
136
+ return cls(
137
+ address_fields=[AddressFields.from_json(i) for i in json['addressFields']],
138
+ )
139
+
140
+
141
+ class FillingStrategy(enum.Enum):
142
+ '''
143
+ Specified whether a filled field was done so by using the html autocomplete attribute or autofill heuristics.
144
+ '''
145
+ AUTOCOMPLETE_ATTRIBUTE = "autocompleteAttribute"
146
+ AUTOFILL_INFERRED = "autofillInferred"
147
+
148
+ def to_json(self) -> str:
149
+ return self.value
150
+
151
+ @classmethod
152
+ def from_json(cls, json: str) -> FillingStrategy:
153
+ return cls(json)
154
+
155
+
156
+ @dataclass
157
+ class FilledField:
158
+ #: The type of the field, e.g text, password etc.
159
+ html_type: str
160
+
161
+ #: the html id
162
+ id_: str
163
+
164
+ #: the html name
165
+ name: str
166
+
167
+ #: the field value
168
+ value: str
169
+
170
+ #: The actual field type, e.g FAMILY_NAME
171
+ autofill_type: str
172
+
173
+ #: The filling strategy
174
+ filling_strategy: FillingStrategy
175
+
176
+ #: The frame the field belongs to
177
+ frame_id: page.FrameId
178
+
179
+ #: The form field's DOM node
180
+ field_id: dom.BackendNodeId
181
+
182
+ def to_json(self) -> T_JSON_DICT:
183
+ json: T_JSON_DICT = dict()
184
+ json['htmlType'] = self.html_type
185
+ json['id'] = self.id_
186
+ json['name'] = self.name
187
+ json['value'] = self.value
188
+ json['autofillType'] = self.autofill_type
189
+ json['fillingStrategy'] = self.filling_strategy.to_json()
190
+ json['frameId'] = self.frame_id.to_json()
191
+ json['fieldId'] = self.field_id.to_json()
192
+ return json
193
+
194
+ @classmethod
195
+ def from_json(cls, json: T_JSON_DICT) -> FilledField:
196
+ return cls(
197
+ html_type=str(json['htmlType']),
198
+ id_=str(json['id']),
199
+ name=str(json['name']),
200
+ value=str(json['value']),
201
+ autofill_type=str(json['autofillType']),
202
+ filling_strategy=FillingStrategy.from_json(json['fillingStrategy']),
203
+ frame_id=page.FrameId.from_json(json['frameId']),
204
+ field_id=dom.BackendNodeId.from_json(json['fieldId']),
205
+ )
206
+
207
+
208
+ def trigger(
209
+ field_id: dom.BackendNodeId,
210
+ frame_id: typing.Optional[page.FrameId] = None,
211
+ card: typing.Optional[CreditCard] = None,
212
+ address: typing.Optional[Address] = None
213
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
214
+ '''
215
+ Trigger autofill on a form identified by the fieldId.
216
+ If the field and related form cannot be autofilled, returns an error.
217
+
218
+ :param field_id: Identifies a field that serves as an anchor for autofill.
219
+ :param frame_id: *(Optional)* Identifies the frame that field belongs to.
220
+ :param card: *(Optional)* Credit card information to fill out the form. Credit card data is not saved. Mutually exclusive with ```address````.
221
+ :param address: *(Optional)* Address to fill out the form. Address data is not saved. Mutually exclusive with ````card```.
222
+ '''
223
+ params: T_JSON_DICT = dict()
224
+ params['fieldId'] = field_id.to_json()
225
+ if frame_id is not None:
226
+ params['frameId'] = frame_id.to_json()
227
+ if card is not None:
228
+ params['card'] = card.to_json()
229
+ if address is not None:
230
+ params['address'] = address.to_json()
231
+ cmd_dict: T_JSON_DICT = {
232
+ 'method': 'Autofill.trigger',
233
+ 'params': params,
234
+ }
235
+ json = yield cmd_dict
236
+
237
+
238
+ def set_addresses(
239
+ addresses: typing.List[Address]
240
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
241
+ '''
242
+ Set addresses so that developers can verify their forms implementation.
243
+
244
+ :param addresses:
245
+ '''
246
+ params: T_JSON_DICT = dict()
247
+ params['addresses'] = [i.to_json() for i in addresses]
248
+ cmd_dict: T_JSON_DICT = {
249
+ 'method': 'Autofill.setAddresses',
250
+ 'params': params,
251
+ }
252
+ json = yield cmd_dict
253
+
254
+
255
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
256
+ '''
257
+ Disables autofill domain notifications.
258
+ '''
259
+ cmd_dict: T_JSON_DICT = {
260
+ 'method': 'Autofill.disable',
261
+ }
262
+ json = yield cmd_dict
263
+
264
+
265
+ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
266
+ '''
267
+ Enables autofill domain notifications.
268
+ '''
269
+ cmd_dict: T_JSON_DICT = {
270
+ 'method': 'Autofill.enable',
271
+ }
272
+ json = yield cmd_dict
273
+
274
+
275
+ @event_class('Autofill.addressFormFilled')
276
+ @dataclass
277
+ class AddressFormFilled:
278
+ '''
279
+ Emitted when an address form is filled.
280
+ '''
281
+ #: Information about the fields that were filled
282
+ filled_fields: typing.List[FilledField]
283
+ #: An UI representation of the address used to fill the form.
284
+ #: Consists of a 2D array where each child represents an address/profile line.
285
+ address_ui: AddressUI
286
+
287
+ @classmethod
288
+ def from_json(cls, json: T_JSON_DICT) -> AddressFormFilled:
289
+ return cls(
290
+ filled_fields=[FilledField.from_json(i) for i in json['filledFields']],
291
+ address_ui=AddressUI.from_json(json['addressUi'])
292
+ )
@@ -0,0 +1,215 @@
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: BackgroundService (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 network
15
+ from . import service_worker
16
+
17
+
18
+ class ServiceName(enum.Enum):
19
+ '''
20
+ The Background Service that will be associated with the commands/events.
21
+ Every Background Service operates independently, but they share the same
22
+ API.
23
+ '''
24
+ BACKGROUND_FETCH = "backgroundFetch"
25
+ BACKGROUND_SYNC = "backgroundSync"
26
+ PUSH_MESSAGING = "pushMessaging"
27
+ NOTIFICATIONS = "notifications"
28
+ PAYMENT_HANDLER = "paymentHandler"
29
+ PERIODIC_BACKGROUND_SYNC = "periodicBackgroundSync"
30
+
31
+ def to_json(self) -> str:
32
+ return self.value
33
+
34
+ @classmethod
35
+ def from_json(cls, json: str) -> ServiceName:
36
+ return cls(json)
37
+
38
+
39
+ @dataclass
40
+ class EventMetadata:
41
+ '''
42
+ A key-value pair for additional event information to pass along.
43
+ '''
44
+ key: str
45
+
46
+ value: str
47
+
48
+ def to_json(self) -> T_JSON_DICT:
49
+ json: T_JSON_DICT = dict()
50
+ json['key'] = self.key
51
+ json['value'] = self.value
52
+ return json
53
+
54
+ @classmethod
55
+ def from_json(cls, json: T_JSON_DICT) -> EventMetadata:
56
+ return cls(
57
+ key=str(json['key']),
58
+ value=str(json['value']),
59
+ )
60
+
61
+
62
+ @dataclass
63
+ class BackgroundServiceEvent:
64
+ #: Timestamp of the event (in seconds).
65
+ timestamp: network.TimeSinceEpoch
66
+
67
+ #: The origin this event belongs to.
68
+ origin: str
69
+
70
+ #: The Service Worker ID that initiated the event.
71
+ service_worker_registration_id: service_worker.RegistrationID
72
+
73
+ #: The Background Service this event belongs to.
74
+ service: ServiceName
75
+
76
+ #: A description of the event.
77
+ event_name: str
78
+
79
+ #: An identifier that groups related events together.
80
+ instance_id: str
81
+
82
+ #: A list of event-specific information.
83
+ event_metadata: typing.List[EventMetadata]
84
+
85
+ #: Storage key this event belongs to.
86
+ storage_key: str
87
+
88
+ def to_json(self) -> T_JSON_DICT:
89
+ json: T_JSON_DICT = dict()
90
+ json['timestamp'] = self.timestamp.to_json()
91
+ json['origin'] = self.origin
92
+ json['serviceWorkerRegistrationId'] = self.service_worker_registration_id.to_json()
93
+ json['service'] = self.service.to_json()
94
+ json['eventName'] = self.event_name
95
+ json['instanceId'] = self.instance_id
96
+ json['eventMetadata'] = [i.to_json() for i in self.event_metadata]
97
+ json['storageKey'] = self.storage_key
98
+ return json
99
+
100
+ @classmethod
101
+ def from_json(cls, json: T_JSON_DICT) -> BackgroundServiceEvent:
102
+ return cls(
103
+ timestamp=network.TimeSinceEpoch.from_json(json['timestamp']),
104
+ origin=str(json['origin']),
105
+ service_worker_registration_id=service_worker.RegistrationID.from_json(json['serviceWorkerRegistrationId']),
106
+ service=ServiceName.from_json(json['service']),
107
+ event_name=str(json['eventName']),
108
+ instance_id=str(json['instanceId']),
109
+ event_metadata=[EventMetadata.from_json(i) for i in json['eventMetadata']],
110
+ storage_key=str(json['storageKey']),
111
+ )
112
+
113
+
114
+ def start_observing(
115
+ service: ServiceName
116
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
117
+ '''
118
+ Enables event updates for the service.
119
+
120
+ :param service:
121
+ '''
122
+ params: T_JSON_DICT = dict()
123
+ params['service'] = service.to_json()
124
+ cmd_dict: T_JSON_DICT = {
125
+ 'method': 'BackgroundService.startObserving',
126
+ 'params': params,
127
+ }
128
+ json = yield cmd_dict
129
+
130
+
131
+ def stop_observing(
132
+ service: ServiceName
133
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
134
+ '''
135
+ Disables event updates for the service.
136
+
137
+ :param service:
138
+ '''
139
+ params: T_JSON_DICT = dict()
140
+ params['service'] = service.to_json()
141
+ cmd_dict: T_JSON_DICT = {
142
+ 'method': 'BackgroundService.stopObserving',
143
+ 'params': params,
144
+ }
145
+ json = yield cmd_dict
146
+
147
+
148
+ def set_recording(
149
+ should_record: bool,
150
+ service: ServiceName
151
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
152
+ '''
153
+ Set the recording state for the service.
154
+
155
+ :param should_record:
156
+ :param service:
157
+ '''
158
+ params: T_JSON_DICT = dict()
159
+ params['shouldRecord'] = should_record
160
+ params['service'] = service.to_json()
161
+ cmd_dict: T_JSON_DICT = {
162
+ 'method': 'BackgroundService.setRecording',
163
+ 'params': params,
164
+ }
165
+ json = yield cmd_dict
166
+
167
+
168
+ def clear_events(
169
+ service: ServiceName
170
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
171
+ '''
172
+ Clears all stored data for the service.
173
+
174
+ :param service:
175
+ '''
176
+ params: T_JSON_DICT = dict()
177
+ params['service'] = service.to_json()
178
+ cmd_dict: T_JSON_DICT = {
179
+ 'method': 'BackgroundService.clearEvents',
180
+ 'params': params,
181
+ }
182
+ json = yield cmd_dict
183
+
184
+
185
+ @event_class('BackgroundService.recordingStateChanged')
186
+ @dataclass
187
+ class RecordingStateChanged:
188
+ '''
189
+ Called when the recording state for the service has been updated.
190
+ '''
191
+ is_recording: bool
192
+ service: ServiceName
193
+
194
+ @classmethod
195
+ def from_json(cls, json: T_JSON_DICT) -> RecordingStateChanged:
196
+ return cls(
197
+ is_recording=bool(json['isRecording']),
198
+ service=ServiceName.from_json(json['service'])
199
+ )
200
+
201
+
202
+ @event_class('BackgroundService.backgroundServiceEventReceived')
203
+ @dataclass
204
+ class BackgroundServiceEventReceived:
205
+ '''
206
+ Called with all existing backgroundServiceEvents when enabled, and all new
207
+ events afterwards if enabled and recording.
208
+ '''
209
+ background_service_event: BackgroundServiceEvent
210
+
211
+ @classmethod
212
+ def from_json(cls, json: T_JSON_DICT) -> BackgroundServiceEventReceived:
213
+ return cls(
214
+ background_service_event=BackgroundServiceEvent.from_json(json['backgroundServiceEvent'])
215
+ )