browserless-bap 0.2.0__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.
- browserless_bap/__init__.py +35 -0
- browserless_bap/_codec.py +29 -0
- browserless_bap/_io.py +27 -0
- browserless_bap/_page_generated.py +1322 -0
- browserless_bap/_unset.py +12 -0
- browserless_bap/_version.py +1 -0
- browserless_bap/async_api.py +3 -0
- browserless_bap/browser.py +108 -0
- browserless_bap/browserless.py +30 -0
- browserless_bap/element_handle.py +120 -0
- browserless_bap/emitter.py +134 -0
- browserless_bap/errors.py +64 -0
- browserless_bap/graphql/__init__.py +11 -0
- browserless_bap/graphql/builder.py +37 -0
- browserless_bap/graphql/mutations.py +417 -0
- browserless_bap/graphql/subscriptions.py +47 -0
- browserless_bap/page.py +771 -0
- browserless_bap/py.typed +1 -0
- browserless_bap/sync_api/__init__.py +24 -0
- browserless_bap/sync_api/_base.py +32 -0
- browserless_bap/sync_api/_bridge.py +419 -0
- browserless_bap/sync_api/_page_generated.py +979 -0
- browserless_bap/sync_api/browser.py +48 -0
- browserless_bap/sync_api/browserless.py +33 -0
- browserless_bap/sync_api/element_handle.py +70 -0
- browserless_bap/sync_api/page.py +383 -0
- browserless_bap/transport.py +522 -0
- browserless_bap/types/__init__.py +7 -0
- browserless_bap/types/enums.py +717 -0
- browserless_bap/types/events.py +121 -0
- browserless_bap/types/inputs.py +71 -0
- browserless_bap/types/options.py +367 -0
- browserless_bap/types/responses.py +314 -0
- browserless_bap-0.2.0.dist-info/METADATA +264 -0
- browserless_bap-0.2.0.dist-info/RECORD +37 -0
- browserless_bap-0.2.0.dist-info/WHEEL +4 -0
- browserless_bap-0.2.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,1322 @@
|
|
|
1
|
+
# Generated by scripts/codegen.py from mutations.graphql -- do not edit.
|
|
2
|
+
# ruff: noqa: ASYNC109, F403, F405
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
6
|
+
|
|
7
|
+
from ._codec import decode_base64, drop_unset, or_default, write_binary_file
|
|
8
|
+
from ._unset import UNSET, UnsetType
|
|
9
|
+
from .types import *
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from .element_handle import ElementHandle
|
|
13
|
+
from .page import Page
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PageGenerated:
|
|
17
|
+
async def _execute(
|
|
18
|
+
self,
|
|
19
|
+
mutation_name: str,
|
|
20
|
+
args: dict[str, object] | None,
|
|
21
|
+
response_type: str,
|
|
22
|
+
*,
|
|
23
|
+
timeout: float | None = None,
|
|
24
|
+
) -> Any:
|
|
25
|
+
raise NotImplementedError
|
|
26
|
+
|
|
27
|
+
async def authenticate(
|
|
28
|
+
self,
|
|
29
|
+
username: str,
|
|
30
|
+
password: str,
|
|
31
|
+
*,
|
|
32
|
+
origin: str | UnsetType = UNSET,
|
|
33
|
+
) -> HTTPResponse | None:
|
|
34
|
+
args = drop_unset(
|
|
35
|
+
{
|
|
36
|
+
"username": username,
|
|
37
|
+
"password": password,
|
|
38
|
+
"origin": origin,
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
return cast(
|
|
42
|
+
"HTTPResponse | None",
|
|
43
|
+
await self._execute(
|
|
44
|
+
"authenticate",
|
|
45
|
+
args,
|
|
46
|
+
"HTTPResponse",
|
|
47
|
+
),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
async def go_back(
|
|
51
|
+
self,
|
|
52
|
+
*,
|
|
53
|
+
timeout: float | UnsetType = UNSET,
|
|
54
|
+
wait_until: WaitUntilHistory | UnsetType = UNSET,
|
|
55
|
+
) -> HTTPResponse | None:
|
|
56
|
+
args = drop_unset(
|
|
57
|
+
{
|
|
58
|
+
"timeout": timeout,
|
|
59
|
+
"waitUntil": wait_until,
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
return cast(
|
|
63
|
+
"HTTPResponse | None",
|
|
64
|
+
await self._execute(
|
|
65
|
+
"back",
|
|
66
|
+
args,
|
|
67
|
+
"HTTPResponse",
|
|
68
|
+
timeout=None if timeout is UNSET else timeout,
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
async def check(
|
|
73
|
+
self,
|
|
74
|
+
selector: str,
|
|
75
|
+
*,
|
|
76
|
+
scroll: bool | UnsetType = UNSET,
|
|
77
|
+
timeout: float | UnsetType = UNSET,
|
|
78
|
+
visible: bool | UnsetType = UNSET,
|
|
79
|
+
wait: bool | UnsetType = UNSET,
|
|
80
|
+
) -> ClickResponse:
|
|
81
|
+
args = drop_unset(
|
|
82
|
+
{
|
|
83
|
+
"selector": selector,
|
|
84
|
+
"scroll": scroll,
|
|
85
|
+
"timeout": timeout,
|
|
86
|
+
"visible": visible,
|
|
87
|
+
"wait": wait,
|
|
88
|
+
"checked": True,
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
return cast(
|
|
92
|
+
"ClickResponse",
|
|
93
|
+
await self._execute(
|
|
94
|
+
"checkbox",
|
|
95
|
+
args,
|
|
96
|
+
"ClickResponse",
|
|
97
|
+
timeout=None if timeout is UNSET else timeout,
|
|
98
|
+
),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
async def uncheck(
|
|
102
|
+
self,
|
|
103
|
+
selector: str,
|
|
104
|
+
*,
|
|
105
|
+
scroll: bool | UnsetType = UNSET,
|
|
106
|
+
timeout: float | UnsetType = UNSET,
|
|
107
|
+
visible: bool | UnsetType = UNSET,
|
|
108
|
+
wait: bool | UnsetType = UNSET,
|
|
109
|
+
) -> ClickResponse:
|
|
110
|
+
args = drop_unset(
|
|
111
|
+
{
|
|
112
|
+
"selector": selector,
|
|
113
|
+
"scroll": scroll,
|
|
114
|
+
"timeout": timeout,
|
|
115
|
+
"visible": visible,
|
|
116
|
+
"wait": wait,
|
|
117
|
+
"checked": False,
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
return cast(
|
|
121
|
+
"ClickResponse",
|
|
122
|
+
await self._execute(
|
|
123
|
+
"checkbox",
|
|
124
|
+
args,
|
|
125
|
+
"ClickResponse",
|
|
126
|
+
timeout=None if timeout is UNSET else timeout,
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
async def click(
|
|
131
|
+
self,
|
|
132
|
+
selector: str,
|
|
133
|
+
*,
|
|
134
|
+
scroll: bool | UnsetType = UNSET,
|
|
135
|
+
timeout: float | UnsetType = UNSET,
|
|
136
|
+
visible: bool | UnsetType = UNSET,
|
|
137
|
+
wait: bool | UnsetType = UNSET,
|
|
138
|
+
) -> ClickResponse:
|
|
139
|
+
args = drop_unset(
|
|
140
|
+
{
|
|
141
|
+
"selector": selector,
|
|
142
|
+
"scroll": scroll,
|
|
143
|
+
"timeout": timeout,
|
|
144
|
+
"visible": visible,
|
|
145
|
+
"wait": wait,
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
return cast(
|
|
149
|
+
"ClickResponse",
|
|
150
|
+
await self._execute(
|
|
151
|
+
"click",
|
|
152
|
+
args,
|
|
153
|
+
"ClickResponse",
|
|
154
|
+
timeout=None if timeout is UNSET else timeout,
|
|
155
|
+
),
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
async def set_content(
|
|
159
|
+
self,
|
|
160
|
+
html: str,
|
|
161
|
+
*,
|
|
162
|
+
timeout: float | UnsetType = UNSET,
|
|
163
|
+
wait_until: WaitUntilHistory | UnsetType = UNSET,
|
|
164
|
+
wait_until_all: list[WaitUntilHistory] | UnsetType = UNSET,
|
|
165
|
+
) -> HTTPResponse | None:
|
|
166
|
+
args = drop_unset(
|
|
167
|
+
{
|
|
168
|
+
"html": html,
|
|
169
|
+
"timeout": timeout,
|
|
170
|
+
"waitUntil": wait_until,
|
|
171
|
+
"waitUntilAll": wait_until_all,
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
return cast(
|
|
175
|
+
"HTTPResponse | None",
|
|
176
|
+
await self._execute(
|
|
177
|
+
"content",
|
|
178
|
+
args,
|
|
179
|
+
"HTTPResponse",
|
|
180
|
+
timeout=None if timeout is UNSET else timeout,
|
|
181
|
+
),
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
async def cookies(
|
|
185
|
+
self,
|
|
186
|
+
) -> list[StandardCookie]:
|
|
187
|
+
args = None
|
|
188
|
+
result = await self._execute(
|
|
189
|
+
"cookies",
|
|
190
|
+
args,
|
|
191
|
+
"CookieResponse",
|
|
192
|
+
)
|
|
193
|
+
return cast(
|
|
194
|
+
"list[StandardCookie]",
|
|
195
|
+
or_default(
|
|
196
|
+
(result or {}).get("cookies"),
|
|
197
|
+
[],
|
|
198
|
+
),
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
async def go_forward(
|
|
202
|
+
self,
|
|
203
|
+
*,
|
|
204
|
+
timeout: float | UnsetType = UNSET,
|
|
205
|
+
wait_until: WaitUntilHistory | UnsetType = UNSET,
|
|
206
|
+
) -> HTTPResponse | None:
|
|
207
|
+
args = drop_unset(
|
|
208
|
+
{
|
|
209
|
+
"timeout": timeout,
|
|
210
|
+
"waitUntil": wait_until,
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
return cast(
|
|
214
|
+
"HTTPResponse | None",
|
|
215
|
+
await self._execute(
|
|
216
|
+
"forward",
|
|
217
|
+
args,
|
|
218
|
+
"HTTPResponse",
|
|
219
|
+
timeout=None if timeout is UNSET else timeout,
|
|
220
|
+
),
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
async def goto(
|
|
224
|
+
self,
|
|
225
|
+
url: str,
|
|
226
|
+
*,
|
|
227
|
+
timeout: float | UnsetType = UNSET,
|
|
228
|
+
wait_until: WaitUntilGoto | UnsetType = UNSET,
|
|
229
|
+
wait_until_all: list[WaitUntilGoto] | UnsetType = UNSET,
|
|
230
|
+
referer: str | UnsetType = UNSET,
|
|
231
|
+
referrer_policy: str | UnsetType = UNSET,
|
|
232
|
+
remote_response_metadata: bool | UnsetType = UNSET,
|
|
233
|
+
) -> HTTPResponse | None:
|
|
234
|
+
args = drop_unset(
|
|
235
|
+
{
|
|
236
|
+
"url": url,
|
|
237
|
+
"timeout": timeout,
|
|
238
|
+
"waitUntil": wait_until,
|
|
239
|
+
"waitUntilAll": wait_until_all,
|
|
240
|
+
"referer": referer,
|
|
241
|
+
"referrerPolicy": referrer_policy,
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
return cast(
|
|
245
|
+
"HTTPResponse | None",
|
|
246
|
+
await self._execute(
|
|
247
|
+
"goto",
|
|
248
|
+
args,
|
|
249
|
+
"HTTPResponse",
|
|
250
|
+
timeout=None if timeout is UNSET else timeout,
|
|
251
|
+
),
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
async def html(
|
|
255
|
+
self,
|
|
256
|
+
*,
|
|
257
|
+
selector: str | UnsetType = UNSET,
|
|
258
|
+
timeout: float | UnsetType = UNSET,
|
|
259
|
+
visible: bool | UnsetType = UNSET,
|
|
260
|
+
clean: CleanInput | UnsetType = UNSET,
|
|
261
|
+
rewrite: HTMLRewriteInput | UnsetType = UNSET,
|
|
262
|
+
) -> HTMLResponse:
|
|
263
|
+
args = drop_unset(
|
|
264
|
+
{
|
|
265
|
+
"selector": selector,
|
|
266
|
+
"timeout": timeout,
|
|
267
|
+
"visible": visible,
|
|
268
|
+
"clean": clean,
|
|
269
|
+
"rewrite": rewrite,
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
return cast(
|
|
273
|
+
"HTMLResponse",
|
|
274
|
+
await self._execute(
|
|
275
|
+
"html",
|
|
276
|
+
args,
|
|
277
|
+
"HTMLResponse",
|
|
278
|
+
timeout=None if timeout is UNSET else timeout,
|
|
279
|
+
),
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
async def content(
|
|
283
|
+
self,
|
|
284
|
+
) -> str:
|
|
285
|
+
args = None
|
|
286
|
+
result = await self._execute(
|
|
287
|
+
"html",
|
|
288
|
+
args,
|
|
289
|
+
"HTMLResponse",
|
|
290
|
+
)
|
|
291
|
+
return cast(
|
|
292
|
+
"str",
|
|
293
|
+
or_default(
|
|
294
|
+
(result or {}).get("html"),
|
|
295
|
+
"",
|
|
296
|
+
),
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
async def set_user_agent(
|
|
300
|
+
self,
|
|
301
|
+
user_agent: str,
|
|
302
|
+
) -> UserAgentResponse:
|
|
303
|
+
args = drop_unset(
|
|
304
|
+
{
|
|
305
|
+
"userAgent": user_agent,
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
return cast(
|
|
309
|
+
"UserAgentResponse",
|
|
310
|
+
await self._execute(
|
|
311
|
+
"userAgent",
|
|
312
|
+
args,
|
|
313
|
+
"UserAgentResponse",
|
|
314
|
+
),
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
async def hover(
|
|
318
|
+
self,
|
|
319
|
+
selector: str,
|
|
320
|
+
*,
|
|
321
|
+
scroll: bool | UnsetType = UNSET,
|
|
322
|
+
timeout: float | UnsetType = UNSET,
|
|
323
|
+
visible: bool | UnsetType = UNSET,
|
|
324
|
+
wait: bool | UnsetType = UNSET,
|
|
325
|
+
x: float | UnsetType = UNSET,
|
|
326
|
+
y: float | UnsetType = UNSET,
|
|
327
|
+
) -> HoverResponse:
|
|
328
|
+
args = drop_unset(
|
|
329
|
+
{
|
|
330
|
+
"selector": selector,
|
|
331
|
+
"scroll": scroll,
|
|
332
|
+
"timeout": timeout,
|
|
333
|
+
"visible": visible,
|
|
334
|
+
"wait": wait,
|
|
335
|
+
"x": x,
|
|
336
|
+
"y": y,
|
|
337
|
+
}
|
|
338
|
+
)
|
|
339
|
+
return cast(
|
|
340
|
+
"HoverResponse",
|
|
341
|
+
await self._execute(
|
|
342
|
+
"hover",
|
|
343
|
+
args,
|
|
344
|
+
"HoverResponse",
|
|
345
|
+
timeout=None if timeout is UNSET else timeout,
|
|
346
|
+
),
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
async def set_java_script_enabled(
|
|
350
|
+
self,
|
|
351
|
+
enabled: bool,
|
|
352
|
+
) -> JavaScriptResponse:
|
|
353
|
+
args = drop_unset(
|
|
354
|
+
{
|
|
355
|
+
"enabled": enabled,
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
return cast(
|
|
359
|
+
"JavaScriptResponse",
|
|
360
|
+
await self._execute(
|
|
361
|
+
"javaScriptEnabled",
|
|
362
|
+
args,
|
|
363
|
+
"JavaScriptResponse",
|
|
364
|
+
),
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
async def live_url(
|
|
368
|
+
self,
|
|
369
|
+
*,
|
|
370
|
+
capture_scale: int | UnsetType = UNSET,
|
|
371
|
+
timeout: float | UnsetType = UNSET,
|
|
372
|
+
interactable: bool | UnsetType = UNSET,
|
|
373
|
+
type: LiveURLStreamType | UnsetType = UNSET,
|
|
374
|
+
quality: int | UnsetType = UNSET,
|
|
375
|
+
resizable: bool | UnsetType = UNSET,
|
|
376
|
+
show_browser_interface: bool | UnsetType = UNSET,
|
|
377
|
+
compressed: bool | UnsetType = UNSET,
|
|
378
|
+
emulate_components: bool | UnsetType = UNSET,
|
|
379
|
+
instructions_layout: InstructionsLayout | UnsetType = UNSET,
|
|
380
|
+
instructions: str | LiveURLInstructions | UnsetType = UNSET,
|
|
381
|
+
instructions_format: InstructionsFormat | UnsetType = UNSET,
|
|
382
|
+
instructions_title: str | UnsetType = UNSET,
|
|
383
|
+
steps: list[str] | UnsetType = UNSET,
|
|
384
|
+
current_step: int | UnsetType = UNSET,
|
|
385
|
+
done_label: str | UnsetType = UNSET,
|
|
386
|
+
fail_label: str | UnsetType = UNSET,
|
|
387
|
+
requester_name: str | UnsetType = UNSET,
|
|
388
|
+
) -> LiveURLResponse:
|
|
389
|
+
args = drop_unset(
|
|
390
|
+
{
|
|
391
|
+
"captureScale": capture_scale,
|
|
392
|
+
"timeout": timeout,
|
|
393
|
+
"interactable": interactable,
|
|
394
|
+
"type": type,
|
|
395
|
+
"quality": quality,
|
|
396
|
+
"resizable": resizable,
|
|
397
|
+
"showBrowserInterface": show_browser_interface,
|
|
398
|
+
"compressed": compressed,
|
|
399
|
+
"emulateComponents": emulate_components,
|
|
400
|
+
"instructionsLayout": instructions_layout,
|
|
401
|
+
"instructions": instructions,
|
|
402
|
+
"instructionsFormat": instructions_format,
|
|
403
|
+
"instructionsTitle": instructions_title,
|
|
404
|
+
"steps": steps,
|
|
405
|
+
"currentStep": current_step,
|
|
406
|
+
"doneLabel": done_label,
|
|
407
|
+
"failLabel": fail_label,
|
|
408
|
+
"requesterName": requester_name,
|
|
409
|
+
}
|
|
410
|
+
)
|
|
411
|
+
return cast(
|
|
412
|
+
"LiveURLResponse",
|
|
413
|
+
await self._execute(
|
|
414
|
+
"liveURL",
|
|
415
|
+
args,
|
|
416
|
+
"LiveURLResponse",
|
|
417
|
+
timeout=None if timeout is UNSET else timeout,
|
|
418
|
+
),
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
async def map_selector(
|
|
422
|
+
self,
|
|
423
|
+
selector: str,
|
|
424
|
+
*,
|
|
425
|
+
timeout: float | UnsetType = UNSET,
|
|
426
|
+
wait: bool | UnsetType = UNSET,
|
|
427
|
+
) -> list[MapSelectorResponse]:
|
|
428
|
+
args = drop_unset(
|
|
429
|
+
{
|
|
430
|
+
"selector": selector,
|
|
431
|
+
"timeout": timeout,
|
|
432
|
+
"wait": wait,
|
|
433
|
+
}
|
|
434
|
+
)
|
|
435
|
+
result = await self._execute(
|
|
436
|
+
"mapSelector",
|
|
437
|
+
args,
|
|
438
|
+
"MapSelectorResponse",
|
|
439
|
+
timeout=None if timeout is UNSET else timeout,
|
|
440
|
+
)
|
|
441
|
+
return cast(
|
|
442
|
+
"list[MapSelectorResponse]",
|
|
443
|
+
or_default(result, []),
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
async def eval_on_selector_all(
|
|
447
|
+
self,
|
|
448
|
+
selector: str,
|
|
449
|
+
*,
|
|
450
|
+
timeout: float | UnsetType = UNSET,
|
|
451
|
+
wait: bool | UnsetType = UNSET,
|
|
452
|
+
) -> list[MapSelectorResponse]:
|
|
453
|
+
args = drop_unset(
|
|
454
|
+
{
|
|
455
|
+
"selector": selector,
|
|
456
|
+
"timeout": timeout,
|
|
457
|
+
"wait": wait,
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
result = await self._execute(
|
|
461
|
+
"mapSelector",
|
|
462
|
+
args,
|
|
463
|
+
"MapSelectorResponse",
|
|
464
|
+
timeout=None if timeout is UNSET else timeout,
|
|
465
|
+
)
|
|
466
|
+
return cast(
|
|
467
|
+
"list[MapSelectorResponse]",
|
|
468
|
+
or_default(result, []),
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
async def pdf(
|
|
472
|
+
self,
|
|
473
|
+
*,
|
|
474
|
+
display_header_footer: bool | UnsetType = UNSET,
|
|
475
|
+
format: PDFPageFormat | UnsetType = UNSET,
|
|
476
|
+
footer_template: str | UnsetType = UNSET,
|
|
477
|
+
generate_document_outline: bool | UnsetType = UNSET,
|
|
478
|
+
generate_tagged_pdf: bool | UnsetType = UNSET,
|
|
479
|
+
landscape: bool | UnsetType = UNSET,
|
|
480
|
+
print_background: bool | UnsetType = UNSET,
|
|
481
|
+
omit_background: bool | UnsetType = UNSET,
|
|
482
|
+
scale: float | UnsetType = UNSET,
|
|
483
|
+
timeout: float | UnsetType = UNSET,
|
|
484
|
+
wait_for_images: bool | UnsetType = UNSET,
|
|
485
|
+
wait_for_fonts: bool | UnsetType = UNSET,
|
|
486
|
+
full_page: bool | UnsetType = UNSET,
|
|
487
|
+
width: float | str | UnsetType = UNSET,
|
|
488
|
+
header_template: str | UnsetType = UNSET,
|
|
489
|
+
height: float | str | UnsetType = UNSET,
|
|
490
|
+
margin_bottom: float | str | UnsetType = UNSET,
|
|
491
|
+
margin_left: float | str | UnsetType = UNSET,
|
|
492
|
+
margin_right: float | str | UnsetType = UNSET,
|
|
493
|
+
margin_top: float | str | UnsetType = UNSET,
|
|
494
|
+
page_ranges: str | UnsetType = UNSET,
|
|
495
|
+
prefer_css_page_size: bool | UnsetType = UNSET,
|
|
496
|
+
transfer_mode: str | UnsetType = UNSET,
|
|
497
|
+
path: str | UnsetType = UNSET,
|
|
498
|
+
) -> bytes:
|
|
499
|
+
args = drop_unset(
|
|
500
|
+
{
|
|
501
|
+
"displayHeaderFooter": display_header_footer,
|
|
502
|
+
"format": format,
|
|
503
|
+
"footerTemplate": footer_template,
|
|
504
|
+
"generateDocumentOutline": generate_document_outline,
|
|
505
|
+
"generateTaggedPDF": generate_tagged_pdf,
|
|
506
|
+
"landscape": landscape,
|
|
507
|
+
"printBackground": print_background,
|
|
508
|
+
"omitBackground": omit_background,
|
|
509
|
+
"scale": scale,
|
|
510
|
+
"timeout": timeout,
|
|
511
|
+
"waitForImages": wait_for_images,
|
|
512
|
+
"waitForFonts": wait_for_fonts,
|
|
513
|
+
"fullPage": full_page,
|
|
514
|
+
"width": width,
|
|
515
|
+
"headerTemplate": header_template,
|
|
516
|
+
"height": height,
|
|
517
|
+
"marginBottom": margin_bottom,
|
|
518
|
+
"marginLeft": margin_left,
|
|
519
|
+
"marginRight": margin_right,
|
|
520
|
+
"marginTop": margin_top,
|
|
521
|
+
"pageRanges": page_ranges,
|
|
522
|
+
"preferCSSPageSize": prefer_css_page_size,
|
|
523
|
+
"transferMode": transfer_mode,
|
|
524
|
+
}
|
|
525
|
+
)
|
|
526
|
+
result = await self._execute(
|
|
527
|
+
"pdf",
|
|
528
|
+
args,
|
|
529
|
+
"PDFResponse",
|
|
530
|
+
timeout=None if timeout is UNSET else timeout,
|
|
531
|
+
)
|
|
532
|
+
data = decode_base64((result or {}).get("base64") or "")
|
|
533
|
+
if path is not UNSET:
|
|
534
|
+
await write_binary_file(path, data)
|
|
535
|
+
return data
|
|
536
|
+
|
|
537
|
+
async def preferences(
|
|
538
|
+
self,
|
|
539
|
+
*,
|
|
540
|
+
timeout: float | UnsetType = UNSET,
|
|
541
|
+
) -> DefaultResponse:
|
|
542
|
+
args = drop_unset(
|
|
543
|
+
{
|
|
544
|
+
"timeout": timeout,
|
|
545
|
+
}
|
|
546
|
+
)
|
|
547
|
+
return cast(
|
|
548
|
+
"DefaultResponse",
|
|
549
|
+
await self._execute(
|
|
550
|
+
"preferences",
|
|
551
|
+
args,
|
|
552
|
+
"DefaultResponse",
|
|
553
|
+
timeout=None if timeout is UNSET else timeout,
|
|
554
|
+
),
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
async def proxy(
|
|
558
|
+
self,
|
|
559
|
+
*,
|
|
560
|
+
network: ProxyNetwork | UnsetType = UNSET,
|
|
561
|
+
country: CountryCode | UnsetType = UNSET,
|
|
562
|
+
city: str | UnsetType = UNSET,
|
|
563
|
+
state: str | UnsetType = UNSET,
|
|
564
|
+
sticky: bool | UnsetType = UNSET,
|
|
565
|
+
preset: str | UnsetType = UNSET,
|
|
566
|
+
server: str | UnsetType = UNSET,
|
|
567
|
+
method: list[Method] | UnsetType = UNSET,
|
|
568
|
+
operator: OperatorType | UnsetType = UNSET,
|
|
569
|
+
type: list[ResourceType] | UnsetType = UNSET,
|
|
570
|
+
url: list[str] | UnsetType = UNSET,
|
|
571
|
+
) -> ProxyResponse:
|
|
572
|
+
args = drop_unset(
|
|
573
|
+
{
|
|
574
|
+
"network": network,
|
|
575
|
+
"country": country,
|
|
576
|
+
"city": city,
|
|
577
|
+
"state": state,
|
|
578
|
+
"sticky": sticky,
|
|
579
|
+
"preset": preset,
|
|
580
|
+
"server": server,
|
|
581
|
+
"method": method,
|
|
582
|
+
"operator": operator,
|
|
583
|
+
"type": type,
|
|
584
|
+
"url": url,
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
return cast(
|
|
588
|
+
"ProxyResponse",
|
|
589
|
+
await self._execute(
|
|
590
|
+
"proxy",
|
|
591
|
+
args,
|
|
592
|
+
"ProxyResponse",
|
|
593
|
+
),
|
|
594
|
+
)
|
|
595
|
+
|
|
596
|
+
async def query_selector(
|
|
597
|
+
self,
|
|
598
|
+
selector: str,
|
|
599
|
+
*,
|
|
600
|
+
timeout: float | UnsetType = UNSET,
|
|
601
|
+
visible: bool | UnsetType = UNSET,
|
|
602
|
+
) -> ElementHandle | None:
|
|
603
|
+
args = drop_unset(
|
|
604
|
+
{
|
|
605
|
+
"selector": selector,
|
|
606
|
+
"timeout": timeout,
|
|
607
|
+
"visible": visible,
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
result = await self._execute(
|
|
611
|
+
"querySelector",
|
|
612
|
+
args,
|
|
613
|
+
"QuerySelectorResponse",
|
|
614
|
+
timeout=None if timeout is UNSET else timeout,
|
|
615
|
+
)
|
|
616
|
+
if result is None:
|
|
617
|
+
return None
|
|
618
|
+
from .element_handle import ElementHandle
|
|
619
|
+
|
|
620
|
+
return ElementHandle(cast("Page", self), selector, result)
|
|
621
|
+
|
|
622
|
+
async def query_selector_all(
|
|
623
|
+
self,
|
|
624
|
+
selector: str,
|
|
625
|
+
*,
|
|
626
|
+
timeout: float | UnsetType = UNSET,
|
|
627
|
+
visible: bool | UnsetType = UNSET,
|
|
628
|
+
) -> list[ElementHandle]:
|
|
629
|
+
args = drop_unset(
|
|
630
|
+
{
|
|
631
|
+
"selector": selector,
|
|
632
|
+
"timeout": timeout,
|
|
633
|
+
"visible": visible,
|
|
634
|
+
}
|
|
635
|
+
)
|
|
636
|
+
results = await self._execute(
|
|
637
|
+
"querySelectorAll",
|
|
638
|
+
args,
|
|
639
|
+
"QuerySelectorResponse",
|
|
640
|
+
timeout=None if timeout is UNSET else timeout,
|
|
641
|
+
)
|
|
642
|
+
from .element_handle import ElementHandle, _selector_at
|
|
643
|
+
|
|
644
|
+
return [
|
|
645
|
+
ElementHandle(cast("Page", self), _selector_at(selector, index), item)
|
|
646
|
+
for index, item in enumerate(results or ())
|
|
647
|
+
]
|
|
648
|
+
|
|
649
|
+
async def reconnect(
|
|
650
|
+
self,
|
|
651
|
+
*,
|
|
652
|
+
timeout: float | UnsetType = UNSET,
|
|
653
|
+
) -> ReconnectionResponse:
|
|
654
|
+
args = drop_unset(
|
|
655
|
+
{
|
|
656
|
+
"timeout": timeout,
|
|
657
|
+
}
|
|
658
|
+
)
|
|
659
|
+
return cast(
|
|
660
|
+
"ReconnectionResponse",
|
|
661
|
+
await self._execute(
|
|
662
|
+
"reconnect",
|
|
663
|
+
args,
|
|
664
|
+
"ReconnectionResponse",
|
|
665
|
+
timeout=None if timeout is UNSET else timeout,
|
|
666
|
+
),
|
|
667
|
+
)
|
|
668
|
+
|
|
669
|
+
async def stop_session_recording(
|
|
670
|
+
self,
|
|
671
|
+
) -> StopSessionRecordingResponse:
|
|
672
|
+
args = None
|
|
673
|
+
return cast(
|
|
674
|
+
"StopSessionRecordingResponse",
|
|
675
|
+
await self._execute(
|
|
676
|
+
"stopSessionRecording",
|
|
677
|
+
args,
|
|
678
|
+
"StopSessionRecordingResponse",
|
|
679
|
+
),
|
|
680
|
+
)
|
|
681
|
+
|
|
682
|
+
async def reject(
|
|
683
|
+
self,
|
|
684
|
+
*,
|
|
685
|
+
enabled: bool | UnsetType = UNSET,
|
|
686
|
+
method: list[Method] | UnsetType = UNSET,
|
|
687
|
+
operator: OperatorType | UnsetType = UNSET,
|
|
688
|
+
type: list[ResourceType] | UnsetType = UNSET,
|
|
689
|
+
url: list[str] | UnsetType = UNSET,
|
|
690
|
+
regex: list[str] | UnsetType = UNSET,
|
|
691
|
+
) -> RejectResponse:
|
|
692
|
+
args = drop_unset(
|
|
693
|
+
{
|
|
694
|
+
"enabled": enabled,
|
|
695
|
+
"method": method,
|
|
696
|
+
"operator": operator,
|
|
697
|
+
"type": type,
|
|
698
|
+
"url": url,
|
|
699
|
+
"regex": regex,
|
|
700
|
+
}
|
|
701
|
+
)
|
|
702
|
+
return cast(
|
|
703
|
+
"RejectResponse",
|
|
704
|
+
await self._execute(
|
|
705
|
+
"reject",
|
|
706
|
+
args,
|
|
707
|
+
"RejectResponse",
|
|
708
|
+
),
|
|
709
|
+
)
|
|
710
|
+
|
|
711
|
+
async def reload(
|
|
712
|
+
self,
|
|
713
|
+
*,
|
|
714
|
+
timeout: float | UnsetType = UNSET,
|
|
715
|
+
wait_until: WaitUntilHistory | UnsetType = UNSET,
|
|
716
|
+
) -> HTTPResponse | None:
|
|
717
|
+
args = drop_unset(
|
|
718
|
+
{
|
|
719
|
+
"timeout": timeout,
|
|
720
|
+
"waitUntil": wait_until,
|
|
721
|
+
}
|
|
722
|
+
)
|
|
723
|
+
return cast(
|
|
724
|
+
"HTTPResponse | None",
|
|
725
|
+
await self._execute(
|
|
726
|
+
"reload",
|
|
727
|
+
args,
|
|
728
|
+
"HTTPResponse",
|
|
729
|
+
timeout=None if timeout is UNSET else timeout,
|
|
730
|
+
),
|
|
731
|
+
)
|
|
732
|
+
|
|
733
|
+
async def request(
|
|
734
|
+
self,
|
|
735
|
+
*,
|
|
736
|
+
type: list[ResourceType] | UnsetType = UNSET,
|
|
737
|
+
method: list[Method] | UnsetType = UNSET,
|
|
738
|
+
timeout: float | UnsetType = UNSET,
|
|
739
|
+
url: list[str] | UnsetType = UNSET,
|
|
740
|
+
wait: bool | UnsetType = UNSET,
|
|
741
|
+
operator: OperatorType | UnsetType = UNSET,
|
|
742
|
+
) -> list[RequestResponse]:
|
|
743
|
+
args = drop_unset(
|
|
744
|
+
{
|
|
745
|
+
"type": type,
|
|
746
|
+
"method": method,
|
|
747
|
+
"timeout": timeout,
|
|
748
|
+
"url": url,
|
|
749
|
+
"wait": wait,
|
|
750
|
+
"operator": operator,
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
result = await self._execute(
|
|
754
|
+
"request",
|
|
755
|
+
args,
|
|
756
|
+
"RequestResponse",
|
|
757
|
+
timeout=None if timeout is UNSET else timeout,
|
|
758
|
+
)
|
|
759
|
+
return cast(
|
|
760
|
+
"list[RequestResponse]",
|
|
761
|
+
or_default(result, []),
|
|
762
|
+
)
|
|
763
|
+
|
|
764
|
+
async def response(
|
|
765
|
+
self,
|
|
766
|
+
*,
|
|
767
|
+
status: list[int] | UnsetType = UNSET,
|
|
768
|
+
method: list[Method] | UnsetType = UNSET,
|
|
769
|
+
operator: OperatorType | UnsetType = UNSET,
|
|
770
|
+
timeout: float | UnsetType = UNSET,
|
|
771
|
+
type: list[ResourceType] | UnsetType = UNSET,
|
|
772
|
+
url: list[str] | UnsetType = UNSET,
|
|
773
|
+
wait: bool | UnsetType = UNSET,
|
|
774
|
+
body_encoding: bool | UnsetType = UNSET,
|
|
775
|
+
) -> list[ResponseResponse]:
|
|
776
|
+
args = drop_unset(
|
|
777
|
+
{
|
|
778
|
+
"status": status,
|
|
779
|
+
"method": method,
|
|
780
|
+
"operator": operator,
|
|
781
|
+
"timeout": timeout,
|
|
782
|
+
"type": type,
|
|
783
|
+
"url": url,
|
|
784
|
+
"wait": wait,
|
|
785
|
+
}
|
|
786
|
+
)
|
|
787
|
+
result = await self._execute(
|
|
788
|
+
"response",
|
|
789
|
+
args,
|
|
790
|
+
"ResponseResponse",
|
|
791
|
+
timeout=None if timeout is UNSET else timeout,
|
|
792
|
+
)
|
|
793
|
+
return cast(
|
|
794
|
+
"list[ResponseResponse]",
|
|
795
|
+
or_default(result, []),
|
|
796
|
+
)
|
|
797
|
+
|
|
798
|
+
async def screenshot(
|
|
799
|
+
self,
|
|
800
|
+
*,
|
|
801
|
+
capture_beyond_viewport: bool | UnsetType = UNSET,
|
|
802
|
+
clip: ScreenshotClip | UnsetType = UNSET,
|
|
803
|
+
from_surface: bool | UnsetType = UNSET,
|
|
804
|
+
full_page: bool | UnsetType = UNSET,
|
|
805
|
+
omit_background: bool | UnsetType = UNSET,
|
|
806
|
+
optimize_for_speed: bool | UnsetType = UNSET,
|
|
807
|
+
quality: float | UnsetType = UNSET,
|
|
808
|
+
selector: str | UnsetType = UNSET,
|
|
809
|
+
type: ScreenshotType | UnsetType = UNSET,
|
|
810
|
+
timeout: float | UnsetType = UNSET,
|
|
811
|
+
wait_for_images: bool | UnsetType = UNSET,
|
|
812
|
+
path: str | UnsetType = UNSET,
|
|
813
|
+
) -> bytes:
|
|
814
|
+
args = drop_unset(
|
|
815
|
+
{
|
|
816
|
+
"captureBeyondViewport": capture_beyond_viewport,
|
|
817
|
+
"clip": clip,
|
|
818
|
+
"fromSurface": from_surface,
|
|
819
|
+
"fullPage": full_page,
|
|
820
|
+
"omitBackground": omit_background,
|
|
821
|
+
"optimizeForSpeed": optimize_for_speed,
|
|
822
|
+
"quality": quality,
|
|
823
|
+
"selector": selector,
|
|
824
|
+
"type": type,
|
|
825
|
+
"timeout": timeout,
|
|
826
|
+
"waitForImages": wait_for_images,
|
|
827
|
+
}
|
|
828
|
+
)
|
|
829
|
+
result = await self._execute(
|
|
830
|
+
"screenshot",
|
|
831
|
+
args,
|
|
832
|
+
"ScreenshotResponse",
|
|
833
|
+
timeout=None if timeout is UNSET else timeout,
|
|
834
|
+
)
|
|
835
|
+
data = decode_base64((result or {}).get("base64") or "")
|
|
836
|
+
if path is not UNSET:
|
|
837
|
+
await write_binary_file(path, data)
|
|
838
|
+
return data
|
|
839
|
+
|
|
840
|
+
async def scroll(
|
|
841
|
+
self,
|
|
842
|
+
*,
|
|
843
|
+
selector: str | UnsetType = UNSET,
|
|
844
|
+
through_page: bool | UnsetType = UNSET,
|
|
845
|
+
timeout: float | UnsetType = UNSET,
|
|
846
|
+
visible: bool | UnsetType = UNSET,
|
|
847
|
+
wait: bool | UnsetType = UNSET,
|
|
848
|
+
x: float | UnsetType = UNSET,
|
|
849
|
+
y: float | UnsetType = UNSET,
|
|
850
|
+
) -> ScrollResponse:
|
|
851
|
+
args = drop_unset(
|
|
852
|
+
{
|
|
853
|
+
"selector": selector,
|
|
854
|
+
"throughPage": through_page,
|
|
855
|
+
"timeout": timeout,
|
|
856
|
+
"visible": visible,
|
|
857
|
+
"wait": wait,
|
|
858
|
+
"x": x,
|
|
859
|
+
"y": y,
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
return cast(
|
|
863
|
+
"ScrollResponse",
|
|
864
|
+
await self._execute(
|
|
865
|
+
"scroll",
|
|
866
|
+
args,
|
|
867
|
+
"ScrollResponse",
|
|
868
|
+
timeout=None if timeout is UNSET else timeout,
|
|
869
|
+
),
|
|
870
|
+
)
|
|
871
|
+
|
|
872
|
+
async def solve(
|
|
873
|
+
self,
|
|
874
|
+
*,
|
|
875
|
+
type: CaptchaType | UnsetType = UNSET,
|
|
876
|
+
timeout: float | UnsetType = UNSET,
|
|
877
|
+
wait: bool | UnsetType = UNSET,
|
|
878
|
+
) -> CaptchaResponse:
|
|
879
|
+
args = drop_unset(
|
|
880
|
+
{
|
|
881
|
+
"type": type,
|
|
882
|
+
"timeout": timeout,
|
|
883
|
+
"wait": wait,
|
|
884
|
+
}
|
|
885
|
+
)
|
|
886
|
+
return cast(
|
|
887
|
+
"CaptchaResponse",
|
|
888
|
+
await self._execute(
|
|
889
|
+
"solve",
|
|
890
|
+
args,
|
|
891
|
+
"CaptchaResponse",
|
|
892
|
+
timeout=None if timeout is UNSET else timeout,
|
|
893
|
+
),
|
|
894
|
+
)
|
|
895
|
+
|
|
896
|
+
async def solve_image_captcha(
|
|
897
|
+
self,
|
|
898
|
+
*,
|
|
899
|
+
captcha_selector: str,
|
|
900
|
+
input_selector: str,
|
|
901
|
+
timeout: float | UnsetType = UNSET,
|
|
902
|
+
) -> CaptchaResponse:
|
|
903
|
+
args = drop_unset(
|
|
904
|
+
{
|
|
905
|
+
"captchaSelector": captcha_selector,
|
|
906
|
+
"inputSelector": input_selector,
|
|
907
|
+
"timeout": timeout,
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
return cast(
|
|
911
|
+
"CaptchaResponse",
|
|
912
|
+
await self._execute(
|
|
913
|
+
"solveImageCaptcha",
|
|
914
|
+
args,
|
|
915
|
+
"CaptchaResponse",
|
|
916
|
+
timeout=None if timeout is UNSET else timeout,
|
|
917
|
+
),
|
|
918
|
+
)
|
|
919
|
+
|
|
920
|
+
async def text(
|
|
921
|
+
self,
|
|
922
|
+
*,
|
|
923
|
+
timeout: float | UnsetType = UNSET,
|
|
924
|
+
selector: str | UnsetType = UNSET,
|
|
925
|
+
visible: bool | UnsetType = UNSET,
|
|
926
|
+
clean: CleanInput | UnsetType = UNSET,
|
|
927
|
+
) -> TextResponse:
|
|
928
|
+
args = drop_unset(
|
|
929
|
+
{
|
|
930
|
+
"timeout": timeout,
|
|
931
|
+
"selector": selector,
|
|
932
|
+
"visible": visible,
|
|
933
|
+
"clean": clean,
|
|
934
|
+
}
|
|
935
|
+
)
|
|
936
|
+
return cast(
|
|
937
|
+
"TextResponse",
|
|
938
|
+
await self._execute(
|
|
939
|
+
"text",
|
|
940
|
+
args,
|
|
941
|
+
"TextResponse",
|
|
942
|
+
timeout=None if timeout is UNSET else timeout,
|
|
943
|
+
),
|
|
944
|
+
)
|
|
945
|
+
|
|
946
|
+
async def eval_on_selector(
|
|
947
|
+
self,
|
|
948
|
+
selector: str,
|
|
949
|
+
) -> str:
|
|
950
|
+
args = drop_unset(
|
|
951
|
+
{
|
|
952
|
+
"selector": selector,
|
|
953
|
+
}
|
|
954
|
+
)
|
|
955
|
+
result = await self._execute(
|
|
956
|
+
"text",
|
|
957
|
+
args,
|
|
958
|
+
"TextResponse",
|
|
959
|
+
)
|
|
960
|
+
return cast(
|
|
961
|
+
"str",
|
|
962
|
+
or_default(
|
|
963
|
+
(result or {}).get("text"),
|
|
964
|
+
"",
|
|
965
|
+
),
|
|
966
|
+
)
|
|
967
|
+
|
|
968
|
+
async def title(
|
|
969
|
+
self,
|
|
970
|
+
) -> str:
|
|
971
|
+
args = None
|
|
972
|
+
result = await self._execute(
|
|
973
|
+
"title",
|
|
974
|
+
args,
|
|
975
|
+
"TitleResponse",
|
|
976
|
+
)
|
|
977
|
+
return cast(
|
|
978
|
+
"str",
|
|
979
|
+
or_default(
|
|
980
|
+
(result or {}).get("title"),
|
|
981
|
+
"",
|
|
982
|
+
),
|
|
983
|
+
)
|
|
984
|
+
|
|
985
|
+
async def type(
|
|
986
|
+
self,
|
|
987
|
+
selector: str,
|
|
988
|
+
text: str,
|
|
989
|
+
*,
|
|
990
|
+
delay: list[int] | UnsetType = UNSET,
|
|
991
|
+
interactable: bool | UnsetType = UNSET,
|
|
992
|
+
scroll: bool | UnsetType = UNSET,
|
|
993
|
+
timeout: float | UnsetType = UNSET,
|
|
994
|
+
visible: bool | UnsetType = UNSET,
|
|
995
|
+
wait: bool | UnsetType = UNSET,
|
|
996
|
+
) -> TypeResponse:
|
|
997
|
+
args = drop_unset(
|
|
998
|
+
{
|
|
999
|
+
"selector": selector,
|
|
1000
|
+
"text": text,
|
|
1001
|
+
"delay": delay,
|
|
1002
|
+
"interactable": interactable,
|
|
1003
|
+
"scroll": scroll,
|
|
1004
|
+
"timeout": timeout,
|
|
1005
|
+
"visible": visible,
|
|
1006
|
+
"wait": wait,
|
|
1007
|
+
}
|
|
1008
|
+
)
|
|
1009
|
+
return cast(
|
|
1010
|
+
"TypeResponse",
|
|
1011
|
+
await self._execute(
|
|
1012
|
+
"type",
|
|
1013
|
+
args,
|
|
1014
|
+
"TypeResponse",
|
|
1015
|
+
timeout=None if timeout is UNSET else timeout,
|
|
1016
|
+
),
|
|
1017
|
+
)
|
|
1018
|
+
|
|
1019
|
+
async def load_secret(
|
|
1020
|
+
self,
|
|
1021
|
+
ref: str,
|
|
1022
|
+
*,
|
|
1023
|
+
selector: str | UnsetType = UNSET,
|
|
1024
|
+
) -> LoadSecretResponse:
|
|
1025
|
+
args = drop_unset(
|
|
1026
|
+
{
|
|
1027
|
+
"ref": ref,
|
|
1028
|
+
"selector": selector,
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
return cast(
|
|
1032
|
+
"LoadSecretResponse",
|
|
1033
|
+
await self._execute(
|
|
1034
|
+
"loadSecret",
|
|
1035
|
+
args,
|
|
1036
|
+
"LoadSecretResponse",
|
|
1037
|
+
),
|
|
1038
|
+
)
|
|
1039
|
+
|
|
1040
|
+
async def url(
|
|
1041
|
+
self,
|
|
1042
|
+
) -> str:
|
|
1043
|
+
args = None
|
|
1044
|
+
result = await self._execute(
|
|
1045
|
+
"url",
|
|
1046
|
+
args,
|
|
1047
|
+
"URLResponse",
|
|
1048
|
+
)
|
|
1049
|
+
return cast(
|
|
1050
|
+
"str",
|
|
1051
|
+
or_default(
|
|
1052
|
+
(result or {}).get("url"),
|
|
1053
|
+
"",
|
|
1054
|
+
),
|
|
1055
|
+
)
|
|
1056
|
+
|
|
1057
|
+
async def wait_for_navigation(
|
|
1058
|
+
self,
|
|
1059
|
+
*,
|
|
1060
|
+
timeout: float | UnsetType = UNSET,
|
|
1061
|
+
wait_until: WaitUntilGoto | UnsetType = UNSET,
|
|
1062
|
+
) -> HTTPResponse:
|
|
1063
|
+
args = drop_unset(
|
|
1064
|
+
{
|
|
1065
|
+
"timeout": timeout,
|
|
1066
|
+
"waitUntil": wait_until,
|
|
1067
|
+
}
|
|
1068
|
+
)
|
|
1069
|
+
return cast(
|
|
1070
|
+
"HTTPResponse",
|
|
1071
|
+
await self._execute(
|
|
1072
|
+
"waitForNavigation",
|
|
1073
|
+
args,
|
|
1074
|
+
"HTTPResponse",
|
|
1075
|
+
timeout=None if timeout is UNSET else timeout,
|
|
1076
|
+
),
|
|
1077
|
+
)
|
|
1078
|
+
|
|
1079
|
+
async def wait_for_network_idle(
|
|
1080
|
+
self,
|
|
1081
|
+
*,
|
|
1082
|
+
idle_time: float | UnsetType = UNSET,
|
|
1083
|
+
concurrency: int | UnsetType = UNSET,
|
|
1084
|
+
timeout: float | UnsetType = UNSET,
|
|
1085
|
+
) -> WaitForTimeoutResponse:
|
|
1086
|
+
args = drop_unset(
|
|
1087
|
+
{
|
|
1088
|
+
"idleTime": idle_time,
|
|
1089
|
+
"concurrency": concurrency,
|
|
1090
|
+
"timeout": timeout,
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1093
|
+
return cast(
|
|
1094
|
+
"WaitForTimeoutResponse",
|
|
1095
|
+
await self._execute(
|
|
1096
|
+
"waitForNetworkIdle",
|
|
1097
|
+
args,
|
|
1098
|
+
"WaitForTimeoutResponse",
|
|
1099
|
+
timeout=None if timeout is UNSET else timeout,
|
|
1100
|
+
),
|
|
1101
|
+
)
|
|
1102
|
+
|
|
1103
|
+
async def wait_for_selector(
|
|
1104
|
+
self,
|
|
1105
|
+
selector: str,
|
|
1106
|
+
*,
|
|
1107
|
+
timeout: float | UnsetType = UNSET,
|
|
1108
|
+
visible: bool | UnsetType = UNSET,
|
|
1109
|
+
hidden: bool | UnsetType = UNSET,
|
|
1110
|
+
) -> WaitForSelectorResponse:
|
|
1111
|
+
args = drop_unset(
|
|
1112
|
+
{
|
|
1113
|
+
"selector": selector,
|
|
1114
|
+
"timeout": timeout,
|
|
1115
|
+
"visible": visible,
|
|
1116
|
+
"hidden": hidden,
|
|
1117
|
+
}
|
|
1118
|
+
)
|
|
1119
|
+
return cast(
|
|
1120
|
+
"WaitForSelectorResponse",
|
|
1121
|
+
await self._execute(
|
|
1122
|
+
"waitForSelector",
|
|
1123
|
+
args,
|
|
1124
|
+
"WaitForSelectorResponse",
|
|
1125
|
+
timeout=None if timeout is UNSET else timeout,
|
|
1126
|
+
),
|
|
1127
|
+
)
|
|
1128
|
+
|
|
1129
|
+
async def wait_for_event(
|
|
1130
|
+
self,
|
|
1131
|
+
event: str,
|
|
1132
|
+
*,
|
|
1133
|
+
timeout: float | UnsetType = UNSET,
|
|
1134
|
+
) -> WaitForEvent:
|
|
1135
|
+
args = drop_unset(
|
|
1136
|
+
{
|
|
1137
|
+
"event": event,
|
|
1138
|
+
"timeout": timeout,
|
|
1139
|
+
}
|
|
1140
|
+
)
|
|
1141
|
+
return cast(
|
|
1142
|
+
"WaitForEvent",
|
|
1143
|
+
await self._execute(
|
|
1144
|
+
"waitForEvent",
|
|
1145
|
+
args,
|
|
1146
|
+
"WaitForEvent",
|
|
1147
|
+
timeout=None if timeout is UNSET else timeout,
|
|
1148
|
+
),
|
|
1149
|
+
)
|
|
1150
|
+
|
|
1151
|
+
async def watch_event(
|
|
1152
|
+
self,
|
|
1153
|
+
event: str,
|
|
1154
|
+
) -> WaitForEvent:
|
|
1155
|
+
"Start tracking `event` now so a later `wait_for_event` call can return immediately if that event has already fired."
|
|
1156
|
+
args = drop_unset(
|
|
1157
|
+
{
|
|
1158
|
+
"event": event,
|
|
1159
|
+
}
|
|
1160
|
+
)
|
|
1161
|
+
return cast(
|
|
1162
|
+
"WaitForEvent",
|
|
1163
|
+
await self._execute(
|
|
1164
|
+
"watchEvent",
|
|
1165
|
+
args,
|
|
1166
|
+
"WaitForEvent",
|
|
1167
|
+
),
|
|
1168
|
+
)
|
|
1169
|
+
|
|
1170
|
+
async def set_viewport_size(
|
|
1171
|
+
self,
|
|
1172
|
+
*,
|
|
1173
|
+
width: float,
|
|
1174
|
+
height: float,
|
|
1175
|
+
device_scale_factor: float | UnsetType = UNSET,
|
|
1176
|
+
mobile: bool | UnsetType = UNSET,
|
|
1177
|
+
has_touch: bool | UnsetType = UNSET,
|
|
1178
|
+
landscape: bool | UnsetType = UNSET,
|
|
1179
|
+
) -> ViewportResponse:
|
|
1180
|
+
args = drop_unset(
|
|
1181
|
+
{
|
|
1182
|
+
"width": width,
|
|
1183
|
+
"height": height,
|
|
1184
|
+
"deviceScaleFactor": device_scale_factor,
|
|
1185
|
+
"mobile": mobile,
|
|
1186
|
+
"hasTouch": has_touch,
|
|
1187
|
+
"landscape": landscape,
|
|
1188
|
+
}
|
|
1189
|
+
)
|
|
1190
|
+
return cast(
|
|
1191
|
+
"ViewportResponse",
|
|
1192
|
+
await self._execute(
|
|
1193
|
+
"viewport",
|
|
1194
|
+
args,
|
|
1195
|
+
"ViewportResponse",
|
|
1196
|
+
),
|
|
1197
|
+
)
|
|
1198
|
+
|
|
1199
|
+
async def switch_to_window(
|
|
1200
|
+
self,
|
|
1201
|
+
*,
|
|
1202
|
+
url: str | UnsetType = UNSET,
|
|
1203
|
+
title: str | UnsetType = UNSET,
|
|
1204
|
+
newest: bool | UnsetType = UNSET,
|
|
1205
|
+
timeout: float | UnsetType = UNSET,
|
|
1206
|
+
wait_until: WaitUntilGoto | UnsetType = UNSET,
|
|
1207
|
+
) -> SwitchWindowResponse:
|
|
1208
|
+
args = drop_unset(
|
|
1209
|
+
{
|
|
1210
|
+
"url": url,
|
|
1211
|
+
"title": title,
|
|
1212
|
+
"newest": newest,
|
|
1213
|
+
"timeout": timeout,
|
|
1214
|
+
"waitUntil": wait_until,
|
|
1215
|
+
}
|
|
1216
|
+
)
|
|
1217
|
+
return cast(
|
|
1218
|
+
"SwitchWindowResponse",
|
|
1219
|
+
await self._execute(
|
|
1220
|
+
"switchToWindow",
|
|
1221
|
+
args,
|
|
1222
|
+
"SwitchWindowResponse",
|
|
1223
|
+
timeout=None if timeout is UNSET else timeout,
|
|
1224
|
+
),
|
|
1225
|
+
)
|
|
1226
|
+
|
|
1227
|
+
async def emulate_media(
|
|
1228
|
+
self,
|
|
1229
|
+
type: MediaType,
|
|
1230
|
+
) -> EmulateMediaTypeResponse:
|
|
1231
|
+
args = drop_unset(
|
|
1232
|
+
{
|
|
1233
|
+
"type": type,
|
|
1234
|
+
}
|
|
1235
|
+
)
|
|
1236
|
+
return cast(
|
|
1237
|
+
"EmulateMediaTypeResponse",
|
|
1238
|
+
await self._execute(
|
|
1239
|
+
"emulateMediaType",
|
|
1240
|
+
args,
|
|
1241
|
+
"EmulateMediaTypeResponse",
|
|
1242
|
+
),
|
|
1243
|
+
)
|
|
1244
|
+
|
|
1245
|
+
async def fulfill(
|
|
1246
|
+
self,
|
|
1247
|
+
*,
|
|
1248
|
+
url: list[str] | UnsetType = UNSET,
|
|
1249
|
+
regex: list[str] | UnsetType = UNSET,
|
|
1250
|
+
method: list[Method] | UnsetType = UNSET,
|
|
1251
|
+
type: list[ResourceType] | UnsetType = UNSET,
|
|
1252
|
+
operator: OperatorType | UnsetType = UNSET,
|
|
1253
|
+
status: int | UnsetType = UNSET,
|
|
1254
|
+
content_type: str | UnsetType = UNSET,
|
|
1255
|
+
body: str | UnsetType = UNSET,
|
|
1256
|
+
base64_body: str | UnsetType = UNSET,
|
|
1257
|
+
headers: list[HeaderInput] | UnsetType = UNSET,
|
|
1258
|
+
) -> FulfillResponse:
|
|
1259
|
+
args = drop_unset(
|
|
1260
|
+
{
|
|
1261
|
+
"url": url,
|
|
1262
|
+
"regex": regex,
|
|
1263
|
+
"method": method,
|
|
1264
|
+
"type": type,
|
|
1265
|
+
"operator": operator,
|
|
1266
|
+
"status": status,
|
|
1267
|
+
"contentType": content_type,
|
|
1268
|
+
"body": body,
|
|
1269
|
+
"base64Body": base64_body,
|
|
1270
|
+
"headers": headers,
|
|
1271
|
+
}
|
|
1272
|
+
)
|
|
1273
|
+
return cast(
|
|
1274
|
+
"FulfillResponse",
|
|
1275
|
+
await self._execute(
|
|
1276
|
+
"fulfill",
|
|
1277
|
+
args,
|
|
1278
|
+
"FulfillResponse",
|
|
1279
|
+
),
|
|
1280
|
+
)
|
|
1281
|
+
|
|
1282
|
+
async def markdown(
|
|
1283
|
+
self,
|
|
1284
|
+
*,
|
|
1285
|
+
selector: str | UnsetType = UNSET,
|
|
1286
|
+
timeout: float | UnsetType = UNSET,
|
|
1287
|
+
visible: bool | UnsetType = UNSET,
|
|
1288
|
+
) -> MarkdownResponse:
|
|
1289
|
+
args = drop_unset(
|
|
1290
|
+
{
|
|
1291
|
+
"selector": selector,
|
|
1292
|
+
"timeout": timeout,
|
|
1293
|
+
"visible": visible,
|
|
1294
|
+
}
|
|
1295
|
+
)
|
|
1296
|
+
return cast(
|
|
1297
|
+
"MarkdownResponse",
|
|
1298
|
+
await self._execute(
|
|
1299
|
+
"markdown",
|
|
1300
|
+
args,
|
|
1301
|
+
"MarkdownResponse",
|
|
1302
|
+
timeout=None if timeout is UNSET else timeout,
|
|
1303
|
+
),
|
|
1304
|
+
)
|
|
1305
|
+
|
|
1306
|
+
async def close_live_url(
|
|
1307
|
+
self,
|
|
1308
|
+
live_url_id: str,
|
|
1309
|
+
) -> CloseLiveURLResponse:
|
|
1310
|
+
args = drop_unset(
|
|
1311
|
+
{
|
|
1312
|
+
"liveURLId": live_url_id,
|
|
1313
|
+
}
|
|
1314
|
+
)
|
|
1315
|
+
return cast(
|
|
1316
|
+
"CloseLiveURLResponse",
|
|
1317
|
+
await self._execute(
|
|
1318
|
+
"closeLiveURL",
|
|
1319
|
+
args,
|
|
1320
|
+
"CloseLiveURLResponse",
|
|
1321
|
+
),
|
|
1322
|
+
)
|