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,1468 @@
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: Overlay (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
+ from . import runtime
17
+ from deprecated.sphinx import deprecated # type: ignore
18
+
19
+
20
+ @dataclass
21
+ class SourceOrderConfig:
22
+ '''
23
+ Configuration data for drawing the source order of an elements children.
24
+ '''
25
+ #: the color to outline the given element in.
26
+ parent_outline_color: dom.RGBA
27
+
28
+ #: the color to outline the child elements in.
29
+ child_outline_color: dom.RGBA
30
+
31
+ def to_json(self) -> T_JSON_DICT:
32
+ json: T_JSON_DICT = dict()
33
+ json['parentOutlineColor'] = self.parent_outline_color.to_json()
34
+ json['childOutlineColor'] = self.child_outline_color.to_json()
35
+ return json
36
+
37
+ @classmethod
38
+ def from_json(cls, json: T_JSON_DICT) -> SourceOrderConfig:
39
+ return cls(
40
+ parent_outline_color=dom.RGBA.from_json(json['parentOutlineColor']),
41
+ child_outline_color=dom.RGBA.from_json(json['childOutlineColor']),
42
+ )
43
+
44
+
45
+ @dataclass
46
+ class GridHighlightConfig:
47
+ '''
48
+ Configuration data for the highlighting of Grid elements.
49
+ '''
50
+ #: Whether the extension lines from grid cells to the rulers should be shown (default: false).
51
+ show_grid_extension_lines: typing.Optional[bool] = None
52
+
53
+ #: Show Positive line number labels (default: false).
54
+ show_positive_line_numbers: typing.Optional[bool] = None
55
+
56
+ #: Show Negative line number labels (default: false).
57
+ show_negative_line_numbers: typing.Optional[bool] = None
58
+
59
+ #: Show area name labels (default: false).
60
+ show_area_names: typing.Optional[bool] = None
61
+
62
+ #: Show line name labels (default: false).
63
+ show_line_names: typing.Optional[bool] = None
64
+
65
+ #: Show track size labels (default: false).
66
+ show_track_sizes: typing.Optional[bool] = None
67
+
68
+ #: The grid container border highlight color (default: transparent).
69
+ grid_border_color: typing.Optional[dom.RGBA] = None
70
+
71
+ #: The cell border color (default: transparent). Deprecated, please use rowLineColor and columnLineColor instead.
72
+ cell_border_color: typing.Optional[dom.RGBA] = None
73
+
74
+ #: The row line color (default: transparent).
75
+ row_line_color: typing.Optional[dom.RGBA] = None
76
+
77
+ #: The column line color (default: transparent).
78
+ column_line_color: typing.Optional[dom.RGBA] = None
79
+
80
+ #: Whether the grid border is dashed (default: false).
81
+ grid_border_dash: typing.Optional[bool] = None
82
+
83
+ #: Whether the cell border is dashed (default: false). Deprecated, please us rowLineDash and columnLineDash instead.
84
+ cell_border_dash: typing.Optional[bool] = None
85
+
86
+ #: Whether row lines are dashed (default: false).
87
+ row_line_dash: typing.Optional[bool] = None
88
+
89
+ #: Whether column lines are dashed (default: false).
90
+ column_line_dash: typing.Optional[bool] = None
91
+
92
+ #: The row gap highlight fill color (default: transparent).
93
+ row_gap_color: typing.Optional[dom.RGBA] = None
94
+
95
+ #: The row gap hatching fill color (default: transparent).
96
+ row_hatch_color: typing.Optional[dom.RGBA] = None
97
+
98
+ #: The column gap highlight fill color (default: transparent).
99
+ column_gap_color: typing.Optional[dom.RGBA] = None
100
+
101
+ #: The column gap hatching fill color (default: transparent).
102
+ column_hatch_color: typing.Optional[dom.RGBA] = None
103
+
104
+ #: The named grid areas border color (Default: transparent).
105
+ area_border_color: typing.Optional[dom.RGBA] = None
106
+
107
+ #: The grid container background color (Default: transparent).
108
+ grid_background_color: typing.Optional[dom.RGBA] = None
109
+
110
+ def to_json(self) -> T_JSON_DICT:
111
+ json: T_JSON_DICT = dict()
112
+ if self.show_grid_extension_lines is not None:
113
+ json['showGridExtensionLines'] = self.show_grid_extension_lines
114
+ if self.show_positive_line_numbers is not None:
115
+ json['showPositiveLineNumbers'] = self.show_positive_line_numbers
116
+ if self.show_negative_line_numbers is not None:
117
+ json['showNegativeLineNumbers'] = self.show_negative_line_numbers
118
+ if self.show_area_names is not None:
119
+ json['showAreaNames'] = self.show_area_names
120
+ if self.show_line_names is not None:
121
+ json['showLineNames'] = self.show_line_names
122
+ if self.show_track_sizes is not None:
123
+ json['showTrackSizes'] = self.show_track_sizes
124
+ if self.grid_border_color is not None:
125
+ json['gridBorderColor'] = self.grid_border_color.to_json()
126
+ if self.cell_border_color is not None:
127
+ json['cellBorderColor'] = self.cell_border_color.to_json()
128
+ if self.row_line_color is not None:
129
+ json['rowLineColor'] = self.row_line_color.to_json()
130
+ if self.column_line_color is not None:
131
+ json['columnLineColor'] = self.column_line_color.to_json()
132
+ if self.grid_border_dash is not None:
133
+ json['gridBorderDash'] = self.grid_border_dash
134
+ if self.cell_border_dash is not None:
135
+ json['cellBorderDash'] = self.cell_border_dash
136
+ if self.row_line_dash is not None:
137
+ json['rowLineDash'] = self.row_line_dash
138
+ if self.column_line_dash is not None:
139
+ json['columnLineDash'] = self.column_line_dash
140
+ if self.row_gap_color is not None:
141
+ json['rowGapColor'] = self.row_gap_color.to_json()
142
+ if self.row_hatch_color is not None:
143
+ json['rowHatchColor'] = self.row_hatch_color.to_json()
144
+ if self.column_gap_color is not None:
145
+ json['columnGapColor'] = self.column_gap_color.to_json()
146
+ if self.column_hatch_color is not None:
147
+ json['columnHatchColor'] = self.column_hatch_color.to_json()
148
+ if self.area_border_color is not None:
149
+ json['areaBorderColor'] = self.area_border_color.to_json()
150
+ if self.grid_background_color is not None:
151
+ json['gridBackgroundColor'] = self.grid_background_color.to_json()
152
+ return json
153
+
154
+ @classmethod
155
+ def from_json(cls, json: T_JSON_DICT) -> GridHighlightConfig:
156
+ return cls(
157
+ show_grid_extension_lines=bool(json['showGridExtensionLines']) if json.get('showGridExtensionLines', None) is not None else None,
158
+ show_positive_line_numbers=bool(json['showPositiveLineNumbers']) if json.get('showPositiveLineNumbers', None) is not None else None,
159
+ show_negative_line_numbers=bool(json['showNegativeLineNumbers']) if json.get('showNegativeLineNumbers', None) is not None else None,
160
+ show_area_names=bool(json['showAreaNames']) if json.get('showAreaNames', None) is not None else None,
161
+ show_line_names=bool(json['showLineNames']) if json.get('showLineNames', None) is not None else None,
162
+ show_track_sizes=bool(json['showTrackSizes']) if json.get('showTrackSizes', None) is not None else None,
163
+ grid_border_color=dom.RGBA.from_json(json['gridBorderColor']) if json.get('gridBorderColor', None) is not None else None,
164
+ cell_border_color=dom.RGBA.from_json(json['cellBorderColor']) if json.get('cellBorderColor', None) is not None else None,
165
+ row_line_color=dom.RGBA.from_json(json['rowLineColor']) if json.get('rowLineColor', None) is not None else None,
166
+ column_line_color=dom.RGBA.from_json(json['columnLineColor']) if json.get('columnLineColor', None) is not None else None,
167
+ grid_border_dash=bool(json['gridBorderDash']) if json.get('gridBorderDash', None) is not None else None,
168
+ cell_border_dash=bool(json['cellBorderDash']) if json.get('cellBorderDash', None) is not None else None,
169
+ row_line_dash=bool(json['rowLineDash']) if json.get('rowLineDash', None) is not None else None,
170
+ column_line_dash=bool(json['columnLineDash']) if json.get('columnLineDash', None) is not None else None,
171
+ row_gap_color=dom.RGBA.from_json(json['rowGapColor']) if json.get('rowGapColor', None) is not None else None,
172
+ row_hatch_color=dom.RGBA.from_json(json['rowHatchColor']) if json.get('rowHatchColor', None) is not None else None,
173
+ column_gap_color=dom.RGBA.from_json(json['columnGapColor']) if json.get('columnGapColor', None) is not None else None,
174
+ column_hatch_color=dom.RGBA.from_json(json['columnHatchColor']) if json.get('columnHatchColor', None) is not None else None,
175
+ area_border_color=dom.RGBA.from_json(json['areaBorderColor']) if json.get('areaBorderColor', None) is not None else None,
176
+ grid_background_color=dom.RGBA.from_json(json['gridBackgroundColor']) if json.get('gridBackgroundColor', None) is not None else None,
177
+ )
178
+
179
+
180
+ @dataclass
181
+ class FlexContainerHighlightConfig:
182
+ '''
183
+ Configuration data for the highlighting of Flex container elements.
184
+ '''
185
+ #: The style of the container border
186
+ container_border: typing.Optional[LineStyle] = None
187
+
188
+ #: The style of the separator between lines
189
+ line_separator: typing.Optional[LineStyle] = None
190
+
191
+ #: The style of the separator between items
192
+ item_separator: typing.Optional[LineStyle] = None
193
+
194
+ #: Style of content-distribution space on the main axis (justify-content).
195
+ main_distributed_space: typing.Optional[BoxStyle] = None
196
+
197
+ #: Style of content-distribution space on the cross axis (align-content).
198
+ cross_distributed_space: typing.Optional[BoxStyle] = None
199
+
200
+ #: Style of empty space caused by row gaps (gap/row-gap).
201
+ row_gap_space: typing.Optional[BoxStyle] = None
202
+
203
+ #: Style of empty space caused by columns gaps (gap/column-gap).
204
+ column_gap_space: typing.Optional[BoxStyle] = None
205
+
206
+ #: Style of the self-alignment line (align-items).
207
+ cross_alignment: typing.Optional[LineStyle] = None
208
+
209
+ def to_json(self) -> T_JSON_DICT:
210
+ json: T_JSON_DICT = dict()
211
+ if self.container_border is not None:
212
+ json['containerBorder'] = self.container_border.to_json()
213
+ if self.line_separator is not None:
214
+ json['lineSeparator'] = self.line_separator.to_json()
215
+ if self.item_separator is not None:
216
+ json['itemSeparator'] = self.item_separator.to_json()
217
+ if self.main_distributed_space is not None:
218
+ json['mainDistributedSpace'] = self.main_distributed_space.to_json()
219
+ if self.cross_distributed_space is not None:
220
+ json['crossDistributedSpace'] = self.cross_distributed_space.to_json()
221
+ if self.row_gap_space is not None:
222
+ json['rowGapSpace'] = self.row_gap_space.to_json()
223
+ if self.column_gap_space is not None:
224
+ json['columnGapSpace'] = self.column_gap_space.to_json()
225
+ if self.cross_alignment is not None:
226
+ json['crossAlignment'] = self.cross_alignment.to_json()
227
+ return json
228
+
229
+ @classmethod
230
+ def from_json(cls, json: T_JSON_DICT) -> FlexContainerHighlightConfig:
231
+ return cls(
232
+ container_border=LineStyle.from_json(json['containerBorder']) if json.get('containerBorder', None) is not None else None,
233
+ line_separator=LineStyle.from_json(json['lineSeparator']) if json.get('lineSeparator', None) is not None else None,
234
+ item_separator=LineStyle.from_json(json['itemSeparator']) if json.get('itemSeparator', None) is not None else None,
235
+ main_distributed_space=BoxStyle.from_json(json['mainDistributedSpace']) if json.get('mainDistributedSpace', None) is not None else None,
236
+ cross_distributed_space=BoxStyle.from_json(json['crossDistributedSpace']) if json.get('crossDistributedSpace', None) is not None else None,
237
+ row_gap_space=BoxStyle.from_json(json['rowGapSpace']) if json.get('rowGapSpace', None) is not None else None,
238
+ column_gap_space=BoxStyle.from_json(json['columnGapSpace']) if json.get('columnGapSpace', None) is not None else None,
239
+ cross_alignment=LineStyle.from_json(json['crossAlignment']) if json.get('crossAlignment', None) is not None else None,
240
+ )
241
+
242
+
243
+ @dataclass
244
+ class FlexItemHighlightConfig:
245
+ '''
246
+ Configuration data for the highlighting of Flex item elements.
247
+ '''
248
+ #: Style of the box representing the item's base size
249
+ base_size_box: typing.Optional[BoxStyle] = None
250
+
251
+ #: Style of the border around the box representing the item's base size
252
+ base_size_border: typing.Optional[LineStyle] = None
253
+
254
+ #: Style of the arrow representing if the item grew or shrank
255
+ flexibility_arrow: typing.Optional[LineStyle] = None
256
+
257
+ def to_json(self) -> T_JSON_DICT:
258
+ json: T_JSON_DICT = dict()
259
+ if self.base_size_box is not None:
260
+ json['baseSizeBox'] = self.base_size_box.to_json()
261
+ if self.base_size_border is not None:
262
+ json['baseSizeBorder'] = self.base_size_border.to_json()
263
+ if self.flexibility_arrow is not None:
264
+ json['flexibilityArrow'] = self.flexibility_arrow.to_json()
265
+ return json
266
+
267
+ @classmethod
268
+ def from_json(cls, json: T_JSON_DICT) -> FlexItemHighlightConfig:
269
+ return cls(
270
+ base_size_box=BoxStyle.from_json(json['baseSizeBox']) if json.get('baseSizeBox', None) is not None else None,
271
+ base_size_border=LineStyle.from_json(json['baseSizeBorder']) if json.get('baseSizeBorder', None) is not None else None,
272
+ flexibility_arrow=LineStyle.from_json(json['flexibilityArrow']) if json.get('flexibilityArrow', None) is not None else None,
273
+ )
274
+
275
+
276
+ @dataclass
277
+ class LineStyle:
278
+ '''
279
+ Style information for drawing a line.
280
+ '''
281
+ #: The color of the line (default: transparent)
282
+ color: typing.Optional[dom.RGBA] = None
283
+
284
+ #: The line pattern (default: solid)
285
+ pattern: typing.Optional[str] = None
286
+
287
+ def to_json(self) -> T_JSON_DICT:
288
+ json: T_JSON_DICT = dict()
289
+ if self.color is not None:
290
+ json['color'] = self.color.to_json()
291
+ if self.pattern is not None:
292
+ json['pattern'] = self.pattern
293
+ return json
294
+
295
+ @classmethod
296
+ def from_json(cls, json: T_JSON_DICT) -> LineStyle:
297
+ return cls(
298
+ color=dom.RGBA.from_json(json['color']) if json.get('color', None) is not None else None,
299
+ pattern=str(json['pattern']) if json.get('pattern', None) is not None else None,
300
+ )
301
+
302
+
303
+ @dataclass
304
+ class BoxStyle:
305
+ '''
306
+ Style information for drawing a box.
307
+ '''
308
+ #: The background color for the box (default: transparent)
309
+ fill_color: typing.Optional[dom.RGBA] = None
310
+
311
+ #: The hatching color for the box (default: transparent)
312
+ hatch_color: typing.Optional[dom.RGBA] = None
313
+
314
+ def to_json(self) -> T_JSON_DICT:
315
+ json: T_JSON_DICT = dict()
316
+ if self.fill_color is not None:
317
+ json['fillColor'] = self.fill_color.to_json()
318
+ if self.hatch_color is not None:
319
+ json['hatchColor'] = self.hatch_color.to_json()
320
+ return json
321
+
322
+ @classmethod
323
+ def from_json(cls, json: T_JSON_DICT) -> BoxStyle:
324
+ return cls(
325
+ fill_color=dom.RGBA.from_json(json['fillColor']) if json.get('fillColor', None) is not None else None,
326
+ hatch_color=dom.RGBA.from_json(json['hatchColor']) if json.get('hatchColor', None) is not None else None,
327
+ )
328
+
329
+
330
+ class ContrastAlgorithm(enum.Enum):
331
+ AA = "aa"
332
+ AAA = "aaa"
333
+ APCA = "apca"
334
+
335
+ def to_json(self) -> str:
336
+ return self.value
337
+
338
+ @classmethod
339
+ def from_json(cls, json: str) -> ContrastAlgorithm:
340
+ return cls(json)
341
+
342
+
343
+ @dataclass
344
+ class HighlightConfig:
345
+ '''
346
+ Configuration data for the highlighting of page elements.
347
+ '''
348
+ #: Whether the node info tooltip should be shown (default: false).
349
+ show_info: typing.Optional[bool] = None
350
+
351
+ #: Whether the node styles in the tooltip (default: false).
352
+ show_styles: typing.Optional[bool] = None
353
+
354
+ #: Whether the rulers should be shown (default: false).
355
+ show_rulers: typing.Optional[bool] = None
356
+
357
+ #: Whether the a11y info should be shown (default: true).
358
+ show_accessibility_info: typing.Optional[bool] = None
359
+
360
+ #: Whether the extension lines from node to the rulers should be shown (default: false).
361
+ show_extension_lines: typing.Optional[bool] = None
362
+
363
+ #: The content box highlight fill color (default: transparent).
364
+ content_color: typing.Optional[dom.RGBA] = None
365
+
366
+ #: The padding highlight fill color (default: transparent).
367
+ padding_color: typing.Optional[dom.RGBA] = None
368
+
369
+ #: The border highlight fill color (default: transparent).
370
+ border_color: typing.Optional[dom.RGBA] = None
371
+
372
+ #: The margin highlight fill color (default: transparent).
373
+ margin_color: typing.Optional[dom.RGBA] = None
374
+
375
+ #: The event target element highlight fill color (default: transparent).
376
+ event_target_color: typing.Optional[dom.RGBA] = None
377
+
378
+ #: The shape outside fill color (default: transparent).
379
+ shape_color: typing.Optional[dom.RGBA] = None
380
+
381
+ #: The shape margin fill color (default: transparent).
382
+ shape_margin_color: typing.Optional[dom.RGBA] = None
383
+
384
+ #: The grid layout color (default: transparent).
385
+ css_grid_color: typing.Optional[dom.RGBA] = None
386
+
387
+ #: The color format used to format color styles (default: hex).
388
+ color_format: typing.Optional[ColorFormat] = None
389
+
390
+ #: The grid layout highlight configuration (default: all transparent).
391
+ grid_highlight_config: typing.Optional[GridHighlightConfig] = None
392
+
393
+ #: The flex container highlight configuration (default: all transparent).
394
+ flex_container_highlight_config: typing.Optional[FlexContainerHighlightConfig] = None
395
+
396
+ #: The flex item highlight configuration (default: all transparent).
397
+ flex_item_highlight_config: typing.Optional[FlexItemHighlightConfig] = None
398
+
399
+ #: The contrast algorithm to use for the contrast ratio (default: aa).
400
+ contrast_algorithm: typing.Optional[ContrastAlgorithm] = None
401
+
402
+ #: The container query container highlight configuration (default: all transparent).
403
+ container_query_container_highlight_config: typing.Optional[ContainerQueryContainerHighlightConfig] = None
404
+
405
+ def to_json(self) -> T_JSON_DICT:
406
+ json: T_JSON_DICT = dict()
407
+ if self.show_info is not None:
408
+ json['showInfo'] = self.show_info
409
+ if self.show_styles is not None:
410
+ json['showStyles'] = self.show_styles
411
+ if self.show_rulers is not None:
412
+ json['showRulers'] = self.show_rulers
413
+ if self.show_accessibility_info is not None:
414
+ json['showAccessibilityInfo'] = self.show_accessibility_info
415
+ if self.show_extension_lines is not None:
416
+ json['showExtensionLines'] = self.show_extension_lines
417
+ if self.content_color is not None:
418
+ json['contentColor'] = self.content_color.to_json()
419
+ if self.padding_color is not None:
420
+ json['paddingColor'] = self.padding_color.to_json()
421
+ if self.border_color is not None:
422
+ json['borderColor'] = self.border_color.to_json()
423
+ if self.margin_color is not None:
424
+ json['marginColor'] = self.margin_color.to_json()
425
+ if self.event_target_color is not None:
426
+ json['eventTargetColor'] = self.event_target_color.to_json()
427
+ if self.shape_color is not None:
428
+ json['shapeColor'] = self.shape_color.to_json()
429
+ if self.shape_margin_color is not None:
430
+ json['shapeMarginColor'] = self.shape_margin_color.to_json()
431
+ if self.css_grid_color is not None:
432
+ json['cssGridColor'] = self.css_grid_color.to_json()
433
+ if self.color_format is not None:
434
+ json['colorFormat'] = self.color_format.to_json()
435
+ if self.grid_highlight_config is not None:
436
+ json['gridHighlightConfig'] = self.grid_highlight_config.to_json()
437
+ if self.flex_container_highlight_config is not None:
438
+ json['flexContainerHighlightConfig'] = self.flex_container_highlight_config.to_json()
439
+ if self.flex_item_highlight_config is not None:
440
+ json['flexItemHighlightConfig'] = self.flex_item_highlight_config.to_json()
441
+ if self.contrast_algorithm is not None:
442
+ json['contrastAlgorithm'] = self.contrast_algorithm.to_json()
443
+ if self.container_query_container_highlight_config is not None:
444
+ json['containerQueryContainerHighlightConfig'] = self.container_query_container_highlight_config.to_json()
445
+ return json
446
+
447
+ @classmethod
448
+ def from_json(cls, json: T_JSON_DICT) -> HighlightConfig:
449
+ return cls(
450
+ show_info=bool(json['showInfo']) if json.get('showInfo', None) is not None else None,
451
+ show_styles=bool(json['showStyles']) if json.get('showStyles', None) is not None else None,
452
+ show_rulers=bool(json['showRulers']) if json.get('showRulers', None) is not None else None,
453
+ show_accessibility_info=bool(json['showAccessibilityInfo']) if json.get('showAccessibilityInfo', None) is not None else None,
454
+ show_extension_lines=bool(json['showExtensionLines']) if json.get('showExtensionLines', None) is not None else None,
455
+ content_color=dom.RGBA.from_json(json['contentColor']) if json.get('contentColor', None) is not None else None,
456
+ padding_color=dom.RGBA.from_json(json['paddingColor']) if json.get('paddingColor', None) is not None else None,
457
+ border_color=dom.RGBA.from_json(json['borderColor']) if json.get('borderColor', None) is not None else None,
458
+ margin_color=dom.RGBA.from_json(json['marginColor']) if json.get('marginColor', None) is not None else None,
459
+ event_target_color=dom.RGBA.from_json(json['eventTargetColor']) if json.get('eventTargetColor', None) is not None else None,
460
+ shape_color=dom.RGBA.from_json(json['shapeColor']) if json.get('shapeColor', None) is not None else None,
461
+ shape_margin_color=dom.RGBA.from_json(json['shapeMarginColor']) if json.get('shapeMarginColor', None) is not None else None,
462
+ css_grid_color=dom.RGBA.from_json(json['cssGridColor']) if json.get('cssGridColor', None) is not None else None,
463
+ color_format=ColorFormat.from_json(json['colorFormat']) if json.get('colorFormat', None) is not None else None,
464
+ grid_highlight_config=GridHighlightConfig.from_json(json['gridHighlightConfig']) if json.get('gridHighlightConfig', None) is not None else None,
465
+ flex_container_highlight_config=FlexContainerHighlightConfig.from_json(json['flexContainerHighlightConfig']) if json.get('flexContainerHighlightConfig', None) is not None else None,
466
+ flex_item_highlight_config=FlexItemHighlightConfig.from_json(json['flexItemHighlightConfig']) if json.get('flexItemHighlightConfig', None) is not None else None,
467
+ contrast_algorithm=ContrastAlgorithm.from_json(json['contrastAlgorithm']) if json.get('contrastAlgorithm', None) is not None else None,
468
+ container_query_container_highlight_config=ContainerQueryContainerHighlightConfig.from_json(json['containerQueryContainerHighlightConfig']) if json.get('containerQueryContainerHighlightConfig', None) is not None else None,
469
+ )
470
+
471
+
472
+ class ColorFormat(enum.Enum):
473
+ RGB = "rgb"
474
+ HSL = "hsl"
475
+ HWB = "hwb"
476
+ HEX_ = "hex"
477
+
478
+ def to_json(self) -> str:
479
+ return self.value
480
+
481
+ @classmethod
482
+ def from_json(cls, json: str) -> ColorFormat:
483
+ return cls(json)
484
+
485
+
486
+ @dataclass
487
+ class GridNodeHighlightConfig:
488
+ '''
489
+ Configurations for Persistent Grid Highlight
490
+ '''
491
+ #: A descriptor for the highlight appearance.
492
+ grid_highlight_config: GridHighlightConfig
493
+
494
+ #: Identifier of the node to highlight.
495
+ node_id: dom.NodeId
496
+
497
+ def to_json(self) -> T_JSON_DICT:
498
+ json: T_JSON_DICT = dict()
499
+ json['gridHighlightConfig'] = self.grid_highlight_config.to_json()
500
+ json['nodeId'] = self.node_id.to_json()
501
+ return json
502
+
503
+ @classmethod
504
+ def from_json(cls, json: T_JSON_DICT) -> GridNodeHighlightConfig:
505
+ return cls(
506
+ grid_highlight_config=GridHighlightConfig.from_json(json['gridHighlightConfig']),
507
+ node_id=dom.NodeId.from_json(json['nodeId']),
508
+ )
509
+
510
+
511
+ @dataclass
512
+ class FlexNodeHighlightConfig:
513
+ #: A descriptor for the highlight appearance of flex containers.
514
+ flex_container_highlight_config: FlexContainerHighlightConfig
515
+
516
+ #: Identifier of the node to highlight.
517
+ node_id: dom.NodeId
518
+
519
+ def to_json(self) -> T_JSON_DICT:
520
+ json: T_JSON_DICT = dict()
521
+ json['flexContainerHighlightConfig'] = self.flex_container_highlight_config.to_json()
522
+ json['nodeId'] = self.node_id.to_json()
523
+ return json
524
+
525
+ @classmethod
526
+ def from_json(cls, json: T_JSON_DICT) -> FlexNodeHighlightConfig:
527
+ return cls(
528
+ flex_container_highlight_config=FlexContainerHighlightConfig.from_json(json['flexContainerHighlightConfig']),
529
+ node_id=dom.NodeId.from_json(json['nodeId']),
530
+ )
531
+
532
+
533
+ @dataclass
534
+ class ScrollSnapContainerHighlightConfig:
535
+ #: The style of the snapport border (default: transparent)
536
+ snapport_border: typing.Optional[LineStyle] = None
537
+
538
+ #: The style of the snap area border (default: transparent)
539
+ snap_area_border: typing.Optional[LineStyle] = None
540
+
541
+ #: The margin highlight fill color (default: transparent).
542
+ scroll_margin_color: typing.Optional[dom.RGBA] = None
543
+
544
+ #: The padding highlight fill color (default: transparent).
545
+ scroll_padding_color: typing.Optional[dom.RGBA] = None
546
+
547
+ def to_json(self) -> T_JSON_DICT:
548
+ json: T_JSON_DICT = dict()
549
+ if self.snapport_border is not None:
550
+ json['snapportBorder'] = self.snapport_border.to_json()
551
+ if self.snap_area_border is not None:
552
+ json['snapAreaBorder'] = self.snap_area_border.to_json()
553
+ if self.scroll_margin_color is not None:
554
+ json['scrollMarginColor'] = self.scroll_margin_color.to_json()
555
+ if self.scroll_padding_color is not None:
556
+ json['scrollPaddingColor'] = self.scroll_padding_color.to_json()
557
+ return json
558
+
559
+ @classmethod
560
+ def from_json(cls, json: T_JSON_DICT) -> ScrollSnapContainerHighlightConfig:
561
+ return cls(
562
+ snapport_border=LineStyle.from_json(json['snapportBorder']) if json.get('snapportBorder', None) is not None else None,
563
+ snap_area_border=LineStyle.from_json(json['snapAreaBorder']) if json.get('snapAreaBorder', None) is not None else None,
564
+ scroll_margin_color=dom.RGBA.from_json(json['scrollMarginColor']) if json.get('scrollMarginColor', None) is not None else None,
565
+ scroll_padding_color=dom.RGBA.from_json(json['scrollPaddingColor']) if json.get('scrollPaddingColor', None) is not None else None,
566
+ )
567
+
568
+
569
+ @dataclass
570
+ class ScrollSnapHighlightConfig:
571
+ #: A descriptor for the highlight appearance of scroll snap containers.
572
+ scroll_snap_container_highlight_config: ScrollSnapContainerHighlightConfig
573
+
574
+ #: Identifier of the node to highlight.
575
+ node_id: dom.NodeId
576
+
577
+ def to_json(self) -> T_JSON_DICT:
578
+ json: T_JSON_DICT = dict()
579
+ json['scrollSnapContainerHighlightConfig'] = self.scroll_snap_container_highlight_config.to_json()
580
+ json['nodeId'] = self.node_id.to_json()
581
+ return json
582
+
583
+ @classmethod
584
+ def from_json(cls, json: T_JSON_DICT) -> ScrollSnapHighlightConfig:
585
+ return cls(
586
+ scroll_snap_container_highlight_config=ScrollSnapContainerHighlightConfig.from_json(json['scrollSnapContainerHighlightConfig']),
587
+ node_id=dom.NodeId.from_json(json['nodeId']),
588
+ )
589
+
590
+
591
+ @dataclass
592
+ class HingeConfig:
593
+ '''
594
+ Configuration for dual screen hinge
595
+ '''
596
+ #: A rectangle represent hinge
597
+ rect: dom.Rect
598
+
599
+ #: The content box highlight fill color (default: a dark color).
600
+ content_color: typing.Optional[dom.RGBA] = None
601
+
602
+ #: The content box highlight outline color (default: transparent).
603
+ outline_color: typing.Optional[dom.RGBA] = None
604
+
605
+ def to_json(self) -> T_JSON_DICT:
606
+ json: T_JSON_DICT = dict()
607
+ json['rect'] = self.rect.to_json()
608
+ if self.content_color is not None:
609
+ json['contentColor'] = self.content_color.to_json()
610
+ if self.outline_color is not None:
611
+ json['outlineColor'] = self.outline_color.to_json()
612
+ return json
613
+
614
+ @classmethod
615
+ def from_json(cls, json: T_JSON_DICT) -> HingeConfig:
616
+ return cls(
617
+ rect=dom.Rect.from_json(json['rect']),
618
+ content_color=dom.RGBA.from_json(json['contentColor']) if json.get('contentColor', None) is not None else None,
619
+ outline_color=dom.RGBA.from_json(json['outlineColor']) if json.get('outlineColor', None) is not None else None,
620
+ )
621
+
622
+
623
+ @dataclass
624
+ class WindowControlsOverlayConfig:
625
+ '''
626
+ Configuration for Window Controls Overlay
627
+ '''
628
+ #: Whether the title bar CSS should be shown when emulating the Window Controls Overlay.
629
+ show_css: bool
630
+
631
+ #: Selected platforms to show the overlay.
632
+ selected_platform: str
633
+
634
+ #: The theme color defined in app manifest.
635
+ theme_color: str
636
+
637
+ def to_json(self) -> T_JSON_DICT:
638
+ json: T_JSON_DICT = dict()
639
+ json['showCSS'] = self.show_css
640
+ json['selectedPlatform'] = self.selected_platform
641
+ json['themeColor'] = self.theme_color
642
+ return json
643
+
644
+ @classmethod
645
+ def from_json(cls, json: T_JSON_DICT) -> WindowControlsOverlayConfig:
646
+ return cls(
647
+ show_css=bool(json['showCSS']),
648
+ selected_platform=str(json['selectedPlatform']),
649
+ theme_color=str(json['themeColor']),
650
+ )
651
+
652
+
653
+ @dataclass
654
+ class ContainerQueryHighlightConfig:
655
+ #: A descriptor for the highlight appearance of container query containers.
656
+ container_query_container_highlight_config: ContainerQueryContainerHighlightConfig
657
+
658
+ #: Identifier of the container node to highlight.
659
+ node_id: dom.NodeId
660
+
661
+ def to_json(self) -> T_JSON_DICT:
662
+ json: T_JSON_DICT = dict()
663
+ json['containerQueryContainerHighlightConfig'] = self.container_query_container_highlight_config.to_json()
664
+ json['nodeId'] = self.node_id.to_json()
665
+ return json
666
+
667
+ @classmethod
668
+ def from_json(cls, json: T_JSON_DICT) -> ContainerQueryHighlightConfig:
669
+ return cls(
670
+ container_query_container_highlight_config=ContainerQueryContainerHighlightConfig.from_json(json['containerQueryContainerHighlightConfig']),
671
+ node_id=dom.NodeId.from_json(json['nodeId']),
672
+ )
673
+
674
+
675
+ @dataclass
676
+ class ContainerQueryContainerHighlightConfig:
677
+ #: The style of the container border.
678
+ container_border: typing.Optional[LineStyle] = None
679
+
680
+ #: The style of the descendants' borders.
681
+ descendant_border: typing.Optional[LineStyle] = None
682
+
683
+ def to_json(self) -> T_JSON_DICT:
684
+ json: T_JSON_DICT = dict()
685
+ if self.container_border is not None:
686
+ json['containerBorder'] = self.container_border.to_json()
687
+ if self.descendant_border is not None:
688
+ json['descendantBorder'] = self.descendant_border.to_json()
689
+ return json
690
+
691
+ @classmethod
692
+ def from_json(cls, json: T_JSON_DICT) -> ContainerQueryContainerHighlightConfig:
693
+ return cls(
694
+ container_border=LineStyle.from_json(json['containerBorder']) if json.get('containerBorder', None) is not None else None,
695
+ descendant_border=LineStyle.from_json(json['descendantBorder']) if json.get('descendantBorder', None) is not None else None,
696
+ )
697
+
698
+
699
+ @dataclass
700
+ class IsolatedElementHighlightConfig:
701
+ #: A descriptor for the highlight appearance of an element in isolation mode.
702
+ isolation_mode_highlight_config: IsolationModeHighlightConfig
703
+
704
+ #: Identifier of the isolated element to highlight.
705
+ node_id: dom.NodeId
706
+
707
+ def to_json(self) -> T_JSON_DICT:
708
+ json: T_JSON_DICT = dict()
709
+ json['isolationModeHighlightConfig'] = self.isolation_mode_highlight_config.to_json()
710
+ json['nodeId'] = self.node_id.to_json()
711
+ return json
712
+
713
+ @classmethod
714
+ def from_json(cls, json: T_JSON_DICT) -> IsolatedElementHighlightConfig:
715
+ return cls(
716
+ isolation_mode_highlight_config=IsolationModeHighlightConfig.from_json(json['isolationModeHighlightConfig']),
717
+ node_id=dom.NodeId.from_json(json['nodeId']),
718
+ )
719
+
720
+
721
+ @dataclass
722
+ class IsolationModeHighlightConfig:
723
+ #: The fill color of the resizers (default: transparent).
724
+ resizer_color: typing.Optional[dom.RGBA] = None
725
+
726
+ #: The fill color for resizer handles (default: transparent).
727
+ resizer_handle_color: typing.Optional[dom.RGBA] = None
728
+
729
+ #: The fill color for the mask covering non-isolated elements (default: transparent).
730
+ mask_color: typing.Optional[dom.RGBA] = None
731
+
732
+ def to_json(self) -> T_JSON_DICT:
733
+ json: T_JSON_DICT = dict()
734
+ if self.resizer_color is not None:
735
+ json['resizerColor'] = self.resizer_color.to_json()
736
+ if self.resizer_handle_color is not None:
737
+ json['resizerHandleColor'] = self.resizer_handle_color.to_json()
738
+ if self.mask_color is not None:
739
+ json['maskColor'] = self.mask_color.to_json()
740
+ return json
741
+
742
+ @classmethod
743
+ def from_json(cls, json: T_JSON_DICT) -> IsolationModeHighlightConfig:
744
+ return cls(
745
+ resizer_color=dom.RGBA.from_json(json['resizerColor']) if json.get('resizerColor', None) is not None else None,
746
+ resizer_handle_color=dom.RGBA.from_json(json['resizerHandleColor']) if json.get('resizerHandleColor', None) is not None else None,
747
+ mask_color=dom.RGBA.from_json(json['maskColor']) if json.get('maskColor', None) is not None else None,
748
+ )
749
+
750
+
751
+ class InspectMode(enum.Enum):
752
+ SEARCH_FOR_NODE = "searchForNode"
753
+ SEARCH_FOR_UA_SHADOW_DOM = "searchForUAShadowDOM"
754
+ CAPTURE_AREA_SCREENSHOT = "captureAreaScreenshot"
755
+ NONE = "none"
756
+
757
+ def to_json(self) -> str:
758
+ return self.value
759
+
760
+ @classmethod
761
+ def from_json(cls, json: str) -> InspectMode:
762
+ return cls(json)
763
+
764
+
765
+ @dataclass
766
+ class InspectedElementAnchorConfig:
767
+ #: Identifier of the node to highlight.
768
+ node_id: typing.Optional[dom.NodeId] = None
769
+
770
+ #: Identifier of the backend node to highlight.
771
+ backend_node_id: typing.Optional[dom.BackendNodeId] = None
772
+
773
+ def to_json(self) -> T_JSON_DICT:
774
+ json: T_JSON_DICT = dict()
775
+ if self.node_id is not None:
776
+ json['nodeId'] = self.node_id.to_json()
777
+ if self.backend_node_id is not None:
778
+ json['backendNodeId'] = self.backend_node_id.to_json()
779
+ return json
780
+
781
+ @classmethod
782
+ def from_json(cls, json: T_JSON_DICT) -> InspectedElementAnchorConfig:
783
+ return cls(
784
+ node_id=dom.NodeId.from_json(json['nodeId']) if json.get('nodeId', None) is not None else None,
785
+ backend_node_id=dom.BackendNodeId.from_json(json['backendNodeId']) if json.get('backendNodeId', None) is not None else None,
786
+ )
787
+
788
+
789
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
790
+ '''
791
+ Disables domain notifications.
792
+ '''
793
+ cmd_dict: T_JSON_DICT = {
794
+ 'method': 'Overlay.disable',
795
+ }
796
+ json = yield cmd_dict
797
+
798
+
799
+ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
800
+ '''
801
+ Enables domain notifications.
802
+ '''
803
+ cmd_dict: T_JSON_DICT = {
804
+ 'method': 'Overlay.enable',
805
+ }
806
+ json = yield cmd_dict
807
+
808
+
809
+ def get_highlight_object_for_test(
810
+ node_id: dom.NodeId,
811
+ include_distance: typing.Optional[bool] = None,
812
+ include_style: typing.Optional[bool] = None,
813
+ color_format: typing.Optional[ColorFormat] = None,
814
+ show_accessibility_info: typing.Optional[bool] = None
815
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dict]:
816
+ '''
817
+ For testing.
818
+
819
+ :param node_id: Id of the node to get highlight object for.
820
+ :param include_distance: *(Optional)* Whether to include distance info.
821
+ :param include_style: *(Optional)* Whether to include style info.
822
+ :param color_format: *(Optional)* The color format to get config with (default: hex).
823
+ :param show_accessibility_info: *(Optional)* Whether to show accessibility info (default: true).
824
+ :returns: Highlight data for the node.
825
+ '''
826
+ params: T_JSON_DICT = dict()
827
+ params['nodeId'] = node_id.to_json()
828
+ if include_distance is not None:
829
+ params['includeDistance'] = include_distance
830
+ if include_style is not None:
831
+ params['includeStyle'] = include_style
832
+ if color_format is not None:
833
+ params['colorFormat'] = color_format.to_json()
834
+ if show_accessibility_info is not None:
835
+ params['showAccessibilityInfo'] = show_accessibility_info
836
+ cmd_dict: T_JSON_DICT = {
837
+ 'method': 'Overlay.getHighlightObjectForTest',
838
+ 'params': params,
839
+ }
840
+ json = yield cmd_dict
841
+ return dict(json['highlight'])
842
+
843
+
844
+ def get_grid_highlight_objects_for_test(
845
+ node_ids: typing.List[dom.NodeId]
846
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dict]:
847
+ '''
848
+ For Persistent Grid testing.
849
+
850
+ :param node_ids: Ids of the node to get highlight object for.
851
+ :returns: Grid Highlight data for the node ids provided.
852
+ '''
853
+ params: T_JSON_DICT = dict()
854
+ params['nodeIds'] = [i.to_json() for i in node_ids]
855
+ cmd_dict: T_JSON_DICT = {
856
+ 'method': 'Overlay.getGridHighlightObjectsForTest',
857
+ 'params': params,
858
+ }
859
+ json = yield cmd_dict
860
+ return dict(json['highlights'])
861
+
862
+
863
+ def get_source_order_highlight_object_for_test(
864
+ node_id: dom.NodeId
865
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dict]:
866
+ '''
867
+ For Source Order Viewer testing.
868
+
869
+ :param node_id: Id of the node to highlight.
870
+ :returns: Source order highlight data for the node id provided.
871
+ '''
872
+ params: T_JSON_DICT = dict()
873
+ params['nodeId'] = node_id.to_json()
874
+ cmd_dict: T_JSON_DICT = {
875
+ 'method': 'Overlay.getSourceOrderHighlightObjectForTest',
876
+ 'params': params,
877
+ }
878
+ json = yield cmd_dict
879
+ return dict(json['highlight'])
880
+
881
+
882
+ def hide_highlight() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
883
+ '''
884
+ Hides any highlight.
885
+ '''
886
+ cmd_dict: T_JSON_DICT = {
887
+ 'method': 'Overlay.hideHighlight',
888
+ }
889
+ json = yield cmd_dict
890
+
891
+
892
+ @deprecated(version="1.3")
893
+ def highlight_frame(
894
+ frame_id: page.FrameId,
895
+ content_color: typing.Optional[dom.RGBA] = None,
896
+ content_outline_color: typing.Optional[dom.RGBA] = None
897
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
898
+ '''
899
+ Highlights owner element of the frame with given id.
900
+ Deprecated: Doesn't work reliably and cannot be fixed due to process
901
+ separation (the owner node might be in a different process). Determine
902
+ the owner node in the client and use highlightNode.
903
+
904
+ .. deprecated:: 1.3
905
+
906
+ :param frame_id: Identifier of the frame to highlight.
907
+ :param content_color: *(Optional)* The content box highlight fill color (default: transparent).
908
+ :param content_outline_color: *(Optional)* The content box highlight outline color (default: transparent).
909
+ '''
910
+ params: T_JSON_DICT = dict()
911
+ params['frameId'] = frame_id.to_json()
912
+ if content_color is not None:
913
+ params['contentColor'] = content_color.to_json()
914
+ if content_outline_color is not None:
915
+ params['contentOutlineColor'] = content_outline_color.to_json()
916
+ cmd_dict: T_JSON_DICT = {
917
+ 'method': 'Overlay.highlightFrame',
918
+ 'params': params,
919
+ }
920
+ json = yield cmd_dict
921
+
922
+
923
+ def highlight_node(
924
+ highlight_config: HighlightConfig,
925
+ node_id: typing.Optional[dom.NodeId] = None,
926
+ backend_node_id: typing.Optional[dom.BackendNodeId] = None,
927
+ object_id: typing.Optional[runtime.RemoteObjectId] = None,
928
+ selector: typing.Optional[str] = None
929
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
930
+ '''
931
+ Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or
932
+ objectId must be specified.
933
+
934
+ :param highlight_config: A descriptor for the highlight appearance.
935
+ :param node_id: *(Optional)* Identifier of the node to highlight.
936
+ :param backend_node_id: *(Optional)* Identifier of the backend node to highlight.
937
+ :param object_id: *(Optional)* JavaScript object id of the node to be highlighted.
938
+ :param selector: *(Optional)* Selectors to highlight relevant nodes.
939
+ '''
940
+ params: T_JSON_DICT = dict()
941
+ params['highlightConfig'] = highlight_config.to_json()
942
+ if node_id is not None:
943
+ params['nodeId'] = node_id.to_json()
944
+ if backend_node_id is not None:
945
+ params['backendNodeId'] = backend_node_id.to_json()
946
+ if object_id is not None:
947
+ params['objectId'] = object_id.to_json()
948
+ if selector is not None:
949
+ params['selector'] = selector
950
+ cmd_dict: T_JSON_DICT = {
951
+ 'method': 'Overlay.highlightNode',
952
+ 'params': params,
953
+ }
954
+ json = yield cmd_dict
955
+
956
+
957
+ def highlight_quad(
958
+ quad: dom.Quad,
959
+ color: typing.Optional[dom.RGBA] = None,
960
+ outline_color: typing.Optional[dom.RGBA] = None
961
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
962
+ '''
963
+ Highlights given quad. Coordinates are absolute with respect to the main frame viewport.
964
+
965
+ :param quad: Quad to highlight
966
+ :param color: *(Optional)* The highlight fill color (default: transparent).
967
+ :param outline_color: *(Optional)* The highlight outline color (default: transparent).
968
+ '''
969
+ params: T_JSON_DICT = dict()
970
+ params['quad'] = quad.to_json()
971
+ if color is not None:
972
+ params['color'] = color.to_json()
973
+ if outline_color is not None:
974
+ params['outlineColor'] = outline_color.to_json()
975
+ cmd_dict: T_JSON_DICT = {
976
+ 'method': 'Overlay.highlightQuad',
977
+ 'params': params,
978
+ }
979
+ json = yield cmd_dict
980
+
981
+
982
+ def highlight_rect(
983
+ x: int,
984
+ y: int,
985
+ width: int,
986
+ height: int,
987
+ color: typing.Optional[dom.RGBA] = None,
988
+ outline_color: typing.Optional[dom.RGBA] = None
989
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
990
+ '''
991
+ Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
992
+ Issue: the method does not handle device pixel ratio (DPR) correctly.
993
+ The coordinates currently have to be adjusted by the client
994
+ if DPR is not 1 (see crbug.com/437807128).
995
+
996
+ :param x: X coordinate
997
+ :param y: Y coordinate
998
+ :param width: Rectangle width
999
+ :param height: Rectangle height
1000
+ :param color: *(Optional)* The highlight fill color (default: transparent).
1001
+ :param outline_color: *(Optional)* The highlight outline color (default: transparent).
1002
+ '''
1003
+ params: T_JSON_DICT = dict()
1004
+ params['x'] = x
1005
+ params['y'] = y
1006
+ params['width'] = width
1007
+ params['height'] = height
1008
+ if color is not None:
1009
+ params['color'] = color.to_json()
1010
+ if outline_color is not None:
1011
+ params['outlineColor'] = outline_color.to_json()
1012
+ cmd_dict: T_JSON_DICT = {
1013
+ 'method': 'Overlay.highlightRect',
1014
+ 'params': params,
1015
+ }
1016
+ json = yield cmd_dict
1017
+
1018
+
1019
+ def highlight_source_order(
1020
+ source_order_config: SourceOrderConfig,
1021
+ node_id: typing.Optional[dom.NodeId] = None,
1022
+ backend_node_id: typing.Optional[dom.BackendNodeId] = None,
1023
+ object_id: typing.Optional[runtime.RemoteObjectId] = None
1024
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1025
+ '''
1026
+ Highlights the source order of the children of the DOM node with given id or with the given
1027
+ JavaScript object wrapper. Either nodeId or objectId must be specified.
1028
+
1029
+ :param source_order_config: A descriptor for the appearance of the overlay drawing.
1030
+ :param node_id: *(Optional)* Identifier of the node to highlight.
1031
+ :param backend_node_id: *(Optional)* Identifier of the backend node to highlight.
1032
+ :param object_id: *(Optional)* JavaScript object id of the node to be highlighted.
1033
+ '''
1034
+ params: T_JSON_DICT = dict()
1035
+ params['sourceOrderConfig'] = source_order_config.to_json()
1036
+ if node_id is not None:
1037
+ params['nodeId'] = node_id.to_json()
1038
+ if backend_node_id is not None:
1039
+ params['backendNodeId'] = backend_node_id.to_json()
1040
+ if object_id is not None:
1041
+ params['objectId'] = object_id.to_json()
1042
+ cmd_dict: T_JSON_DICT = {
1043
+ 'method': 'Overlay.highlightSourceOrder',
1044
+ 'params': params,
1045
+ }
1046
+ json = yield cmd_dict
1047
+
1048
+
1049
+ def set_inspect_mode(
1050
+ mode: InspectMode,
1051
+ highlight_config: typing.Optional[HighlightConfig] = None
1052
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1053
+ '''
1054
+ Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted.
1055
+ Backend then generates 'inspectNodeRequested' event upon element selection.
1056
+
1057
+ :param mode: Set an inspection mode.
1058
+ :param highlight_config: *(Optional)* A descriptor for the highlight appearance of hovered-over nodes. May be omitted if ```enabled == false```.
1059
+ '''
1060
+ params: T_JSON_DICT = dict()
1061
+ params['mode'] = mode.to_json()
1062
+ if highlight_config is not None:
1063
+ params['highlightConfig'] = highlight_config.to_json()
1064
+ cmd_dict: T_JSON_DICT = {
1065
+ 'method': 'Overlay.setInspectMode',
1066
+ 'params': params,
1067
+ }
1068
+ json = yield cmd_dict
1069
+
1070
+
1071
+ def set_show_ad_highlights(
1072
+ show: bool
1073
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1074
+ '''
1075
+ Highlights owner element of all frames detected to be ads.
1076
+
1077
+ :param show: True for showing ad highlights
1078
+ '''
1079
+ params: T_JSON_DICT = dict()
1080
+ params['show'] = show
1081
+ cmd_dict: T_JSON_DICT = {
1082
+ 'method': 'Overlay.setShowAdHighlights',
1083
+ 'params': params,
1084
+ }
1085
+ json = yield cmd_dict
1086
+
1087
+
1088
+ def set_paused_in_debugger_message(
1089
+ message: typing.Optional[str] = None
1090
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1091
+ '''
1092
+ :param message: *(Optional)* The message to display, also triggers resume and step over controls.
1093
+ '''
1094
+ params: T_JSON_DICT = dict()
1095
+ if message is not None:
1096
+ params['message'] = message
1097
+ cmd_dict: T_JSON_DICT = {
1098
+ 'method': 'Overlay.setPausedInDebuggerMessage',
1099
+ 'params': params,
1100
+ }
1101
+ json = yield cmd_dict
1102
+
1103
+
1104
+ def set_show_debug_borders(
1105
+ show: bool
1106
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1107
+ '''
1108
+ Requests that backend shows debug borders on layers
1109
+
1110
+ :param show: True for showing debug borders
1111
+ '''
1112
+ params: T_JSON_DICT = dict()
1113
+ params['show'] = show
1114
+ cmd_dict: T_JSON_DICT = {
1115
+ 'method': 'Overlay.setShowDebugBorders',
1116
+ 'params': params,
1117
+ }
1118
+ json = yield cmd_dict
1119
+
1120
+
1121
+ def set_show_fps_counter(
1122
+ show: bool
1123
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1124
+ '''
1125
+ Requests that backend shows the FPS counter
1126
+
1127
+ :param show: True for showing the FPS counter
1128
+ '''
1129
+ params: T_JSON_DICT = dict()
1130
+ params['show'] = show
1131
+ cmd_dict: T_JSON_DICT = {
1132
+ 'method': 'Overlay.setShowFPSCounter',
1133
+ 'params': params,
1134
+ }
1135
+ json = yield cmd_dict
1136
+
1137
+
1138
+ def set_show_grid_overlays(
1139
+ grid_node_highlight_configs: typing.List[GridNodeHighlightConfig]
1140
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1141
+ '''
1142
+ Highlight multiple elements with the CSS Grid overlay.
1143
+
1144
+ :param grid_node_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
1145
+ '''
1146
+ params: T_JSON_DICT = dict()
1147
+ params['gridNodeHighlightConfigs'] = [i.to_json() for i in grid_node_highlight_configs]
1148
+ cmd_dict: T_JSON_DICT = {
1149
+ 'method': 'Overlay.setShowGridOverlays',
1150
+ 'params': params,
1151
+ }
1152
+ json = yield cmd_dict
1153
+
1154
+
1155
+ def set_show_flex_overlays(
1156
+ flex_node_highlight_configs: typing.List[FlexNodeHighlightConfig]
1157
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1158
+ '''
1159
+ :param flex_node_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
1160
+ '''
1161
+ params: T_JSON_DICT = dict()
1162
+ params['flexNodeHighlightConfigs'] = [i.to_json() for i in flex_node_highlight_configs]
1163
+ cmd_dict: T_JSON_DICT = {
1164
+ 'method': 'Overlay.setShowFlexOverlays',
1165
+ 'params': params,
1166
+ }
1167
+ json = yield cmd_dict
1168
+
1169
+
1170
+ def set_show_scroll_snap_overlays(
1171
+ scroll_snap_highlight_configs: typing.List[ScrollSnapHighlightConfig]
1172
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1173
+ '''
1174
+ :param scroll_snap_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
1175
+ '''
1176
+ params: T_JSON_DICT = dict()
1177
+ params['scrollSnapHighlightConfigs'] = [i.to_json() for i in scroll_snap_highlight_configs]
1178
+ cmd_dict: T_JSON_DICT = {
1179
+ 'method': 'Overlay.setShowScrollSnapOverlays',
1180
+ 'params': params,
1181
+ }
1182
+ json = yield cmd_dict
1183
+
1184
+
1185
+ def set_show_container_query_overlays(
1186
+ container_query_highlight_configs: typing.List[ContainerQueryHighlightConfig]
1187
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1188
+ '''
1189
+ :param container_query_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
1190
+ '''
1191
+ params: T_JSON_DICT = dict()
1192
+ params['containerQueryHighlightConfigs'] = [i.to_json() for i in container_query_highlight_configs]
1193
+ cmd_dict: T_JSON_DICT = {
1194
+ 'method': 'Overlay.setShowContainerQueryOverlays',
1195
+ 'params': params,
1196
+ }
1197
+ json = yield cmd_dict
1198
+
1199
+
1200
+ def set_show_inspected_element_anchor(
1201
+ inspected_element_anchor_config: InspectedElementAnchorConfig
1202
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1203
+ '''
1204
+ :param inspected_element_anchor_config: Node identifier for which to show an anchor for.
1205
+ '''
1206
+ params: T_JSON_DICT = dict()
1207
+ params['inspectedElementAnchorConfig'] = inspected_element_anchor_config.to_json()
1208
+ cmd_dict: T_JSON_DICT = {
1209
+ 'method': 'Overlay.setShowInspectedElementAnchor',
1210
+ 'params': params,
1211
+ }
1212
+ json = yield cmd_dict
1213
+
1214
+
1215
+ def set_show_paint_rects(
1216
+ result: bool
1217
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1218
+ '''
1219
+ Requests that backend shows paint rectangles
1220
+
1221
+ :param result: True for showing paint rectangles
1222
+ '''
1223
+ params: T_JSON_DICT = dict()
1224
+ params['result'] = result
1225
+ cmd_dict: T_JSON_DICT = {
1226
+ 'method': 'Overlay.setShowPaintRects',
1227
+ 'params': params,
1228
+ }
1229
+ json = yield cmd_dict
1230
+
1231
+
1232
+ def set_show_layout_shift_regions(
1233
+ result: bool
1234
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1235
+ '''
1236
+ Requests that backend shows layout shift regions
1237
+
1238
+ :param result: True for showing layout shift regions
1239
+ '''
1240
+ params: T_JSON_DICT = dict()
1241
+ params['result'] = result
1242
+ cmd_dict: T_JSON_DICT = {
1243
+ 'method': 'Overlay.setShowLayoutShiftRegions',
1244
+ 'params': params,
1245
+ }
1246
+ json = yield cmd_dict
1247
+
1248
+
1249
+ def set_show_scroll_bottleneck_rects(
1250
+ show: bool
1251
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1252
+ '''
1253
+ Requests that backend shows scroll bottleneck rects
1254
+
1255
+ :param show: True for showing scroll bottleneck rects
1256
+ '''
1257
+ params: T_JSON_DICT = dict()
1258
+ params['show'] = show
1259
+ cmd_dict: T_JSON_DICT = {
1260
+ 'method': 'Overlay.setShowScrollBottleneckRects',
1261
+ 'params': params,
1262
+ }
1263
+ json = yield cmd_dict
1264
+
1265
+
1266
+ @deprecated(version="1.3")
1267
+ def set_show_hit_test_borders(
1268
+ show: bool
1269
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1270
+ '''
1271
+ Deprecated, no longer has any effect.
1272
+
1273
+ .. deprecated:: 1.3
1274
+
1275
+ :param show: True for showing hit-test borders
1276
+ '''
1277
+ params: T_JSON_DICT = dict()
1278
+ params['show'] = show
1279
+ cmd_dict: T_JSON_DICT = {
1280
+ 'method': 'Overlay.setShowHitTestBorders',
1281
+ 'params': params,
1282
+ }
1283
+ json = yield cmd_dict
1284
+
1285
+
1286
+ @deprecated(version="1.3")
1287
+ def set_show_web_vitals(
1288
+ show: bool
1289
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1290
+ '''
1291
+ Deprecated, no longer has any effect.
1292
+
1293
+ .. deprecated:: 1.3
1294
+
1295
+ :param show:
1296
+ '''
1297
+ params: T_JSON_DICT = dict()
1298
+ params['show'] = show
1299
+ cmd_dict: T_JSON_DICT = {
1300
+ 'method': 'Overlay.setShowWebVitals',
1301
+ 'params': params,
1302
+ }
1303
+ json = yield cmd_dict
1304
+
1305
+
1306
+ def set_show_viewport_size_on_resize(
1307
+ show: bool
1308
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1309
+ '''
1310
+ Paints viewport size upon main frame resize.
1311
+
1312
+ :param show: Whether to paint size or not.
1313
+ '''
1314
+ params: T_JSON_DICT = dict()
1315
+ params['show'] = show
1316
+ cmd_dict: T_JSON_DICT = {
1317
+ 'method': 'Overlay.setShowViewportSizeOnResize',
1318
+ 'params': params,
1319
+ }
1320
+ json = yield cmd_dict
1321
+
1322
+
1323
+ def set_show_hinge(
1324
+ hinge_config: typing.Optional[HingeConfig] = None
1325
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1326
+ '''
1327
+ Add a dual screen device hinge
1328
+
1329
+ :param hinge_config: *(Optional)* hinge data, null means hideHinge
1330
+ '''
1331
+ params: T_JSON_DICT = dict()
1332
+ if hinge_config is not None:
1333
+ params['hingeConfig'] = hinge_config.to_json()
1334
+ cmd_dict: T_JSON_DICT = {
1335
+ 'method': 'Overlay.setShowHinge',
1336
+ 'params': params,
1337
+ }
1338
+ json = yield cmd_dict
1339
+
1340
+
1341
+ def set_show_isolated_elements(
1342
+ isolated_element_highlight_configs: typing.List[IsolatedElementHighlightConfig]
1343
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1344
+ '''
1345
+ Show elements in isolation mode with overlays.
1346
+
1347
+ :param isolated_element_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
1348
+ '''
1349
+ params: T_JSON_DICT = dict()
1350
+ params['isolatedElementHighlightConfigs'] = [i.to_json() for i in isolated_element_highlight_configs]
1351
+ cmd_dict: T_JSON_DICT = {
1352
+ 'method': 'Overlay.setShowIsolatedElements',
1353
+ 'params': params,
1354
+ }
1355
+ json = yield cmd_dict
1356
+
1357
+
1358
+ def set_show_window_controls_overlay(
1359
+ window_controls_overlay_config: typing.Optional[WindowControlsOverlayConfig] = None
1360
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1361
+ '''
1362
+ Show Window Controls Overlay for PWA
1363
+
1364
+ :param window_controls_overlay_config: *(Optional)* Window Controls Overlay data, null means hide Window Controls Overlay
1365
+ '''
1366
+ params: T_JSON_DICT = dict()
1367
+ if window_controls_overlay_config is not None:
1368
+ params['windowControlsOverlayConfig'] = window_controls_overlay_config.to_json()
1369
+ cmd_dict: T_JSON_DICT = {
1370
+ 'method': 'Overlay.setShowWindowControlsOverlay',
1371
+ 'params': params,
1372
+ }
1373
+ json = yield cmd_dict
1374
+
1375
+
1376
+ @event_class('Overlay.inspectNodeRequested')
1377
+ @dataclass
1378
+ class InspectNodeRequested:
1379
+ '''
1380
+ Fired when the node should be inspected. This happens after call to ``setInspectMode`` or when
1381
+ user manually inspects an element.
1382
+ '''
1383
+ #: Id of the node to inspect.
1384
+ backend_node_id: dom.BackendNodeId
1385
+
1386
+ @classmethod
1387
+ def from_json(cls, json: T_JSON_DICT) -> InspectNodeRequested:
1388
+ return cls(
1389
+ backend_node_id=dom.BackendNodeId.from_json(json['backendNodeId'])
1390
+ )
1391
+
1392
+
1393
+ @event_class('Overlay.nodeHighlightRequested')
1394
+ @dataclass
1395
+ class NodeHighlightRequested:
1396
+ '''
1397
+ Fired when the node should be highlighted. This happens after call to ``setInspectMode``.
1398
+ '''
1399
+ node_id: dom.NodeId
1400
+
1401
+ @classmethod
1402
+ def from_json(cls, json: T_JSON_DICT) -> NodeHighlightRequested:
1403
+ return cls(
1404
+ node_id=dom.NodeId.from_json(json['nodeId'])
1405
+ )
1406
+
1407
+
1408
+ @event_class('Overlay.screenshotRequested')
1409
+ @dataclass
1410
+ class ScreenshotRequested:
1411
+ '''
1412
+ Fired when user asks to capture screenshot of some area on the page.
1413
+ '''
1414
+ #: Viewport to capture, in device independent pixels (dip).
1415
+ viewport: page.Viewport
1416
+
1417
+ @classmethod
1418
+ def from_json(cls, json: T_JSON_DICT) -> ScreenshotRequested:
1419
+ return cls(
1420
+ viewport=page.Viewport.from_json(json['viewport'])
1421
+ )
1422
+
1423
+
1424
+ @event_class('Overlay.inspectPanelShowRequested')
1425
+ @dataclass
1426
+ class InspectPanelShowRequested:
1427
+ '''
1428
+ Fired when user asks to show the Inspect panel.
1429
+ '''
1430
+ #: Id of the node to show in the panel.
1431
+ backend_node_id: dom.BackendNodeId
1432
+
1433
+ @classmethod
1434
+ def from_json(cls, json: T_JSON_DICT) -> InspectPanelShowRequested:
1435
+ return cls(
1436
+ backend_node_id=dom.BackendNodeId.from_json(json['backendNodeId'])
1437
+ )
1438
+
1439
+
1440
+ @event_class('Overlay.inspectedElementWindowRestored')
1441
+ @dataclass
1442
+ class InspectedElementWindowRestored:
1443
+ '''
1444
+ Fired when user asks to restore the Inspected Element floating window.
1445
+ '''
1446
+ #: Id of the node to restore the floating window for.
1447
+ backend_node_id: dom.BackendNodeId
1448
+
1449
+ @classmethod
1450
+ def from_json(cls, json: T_JSON_DICT) -> InspectedElementWindowRestored:
1451
+ return cls(
1452
+ backend_node_id=dom.BackendNodeId.from_json(json['backendNodeId'])
1453
+ )
1454
+
1455
+
1456
+ @event_class('Overlay.inspectModeCanceled')
1457
+ @dataclass
1458
+ class InspectModeCanceled:
1459
+ '''
1460
+ Fired when user cancels the inspect mode.
1461
+ '''
1462
+
1463
+
1464
+ @classmethod
1465
+ def from_json(cls, json: T_JSON_DICT) -> InspectModeCanceled:
1466
+ return cls(
1467
+
1468
+ )