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.
Files changed (37) hide show
  1. browserless_bap/__init__.py +35 -0
  2. browserless_bap/_codec.py +29 -0
  3. browserless_bap/_io.py +27 -0
  4. browserless_bap/_page_generated.py +1322 -0
  5. browserless_bap/_unset.py +12 -0
  6. browserless_bap/_version.py +1 -0
  7. browserless_bap/async_api.py +3 -0
  8. browserless_bap/browser.py +108 -0
  9. browserless_bap/browserless.py +30 -0
  10. browserless_bap/element_handle.py +120 -0
  11. browserless_bap/emitter.py +134 -0
  12. browserless_bap/errors.py +64 -0
  13. browserless_bap/graphql/__init__.py +11 -0
  14. browserless_bap/graphql/builder.py +37 -0
  15. browserless_bap/graphql/mutations.py +417 -0
  16. browserless_bap/graphql/subscriptions.py +47 -0
  17. browserless_bap/page.py +771 -0
  18. browserless_bap/py.typed +1 -0
  19. browserless_bap/sync_api/__init__.py +24 -0
  20. browserless_bap/sync_api/_base.py +32 -0
  21. browserless_bap/sync_api/_bridge.py +419 -0
  22. browserless_bap/sync_api/_page_generated.py +979 -0
  23. browserless_bap/sync_api/browser.py +48 -0
  24. browserless_bap/sync_api/browserless.py +33 -0
  25. browserless_bap/sync_api/element_handle.py +70 -0
  26. browserless_bap/sync_api/page.py +383 -0
  27. browserless_bap/transport.py +522 -0
  28. browserless_bap/types/__init__.py +7 -0
  29. browserless_bap/types/enums.py +717 -0
  30. browserless_bap/types/events.py +121 -0
  31. browserless_bap/types/inputs.py +71 -0
  32. browserless_bap/types/options.py +367 -0
  33. browserless_bap/types/responses.py +314 -0
  34. browserless_bap-0.2.0.dist-info/METADATA +264 -0
  35. browserless_bap-0.2.0.dist-info/RECORD +37 -0
  36. browserless_bap-0.2.0.dist-info/WHEEL +4 -0
  37. browserless_bap-0.2.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,979 @@
1
+ # Generated by scripts/codegen.py from mutations.graphql -- do not edit.
2
+ # ruff: noqa: F403, F405
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING, Any, cast
6
+
7
+ from .._unset import UNSET, UnsetType
8
+ from ..types import *
9
+
10
+ if TYPE_CHECKING:
11
+ from .element_handle import ElementHandle
12
+
13
+
14
+ class PageGenerated:
15
+ if TYPE_CHECKING:
16
+
17
+ def _invoke(
18
+ self,
19
+ method_name: str,
20
+ *args: object,
21
+ **kwargs: object,
22
+ ) -> Any: ...
23
+
24
+ def authenticate(
25
+ self,
26
+ username: str,
27
+ password: str,
28
+ *,
29
+ origin: str | UnsetType = UNSET,
30
+ ) -> HTTPResponse | None:
31
+ return cast(
32
+ "HTTPResponse | None",
33
+ self._invoke(
34
+ "authenticate",
35
+ username,
36
+ password,
37
+ origin=origin,
38
+ ),
39
+ )
40
+
41
+ def go_back(
42
+ self,
43
+ *,
44
+ timeout: float | UnsetType = UNSET,
45
+ wait_until: WaitUntilHistory | UnsetType = UNSET,
46
+ ) -> HTTPResponse | None:
47
+ return cast(
48
+ "HTTPResponse | None",
49
+ self._invoke(
50
+ "go_back",
51
+ timeout=timeout,
52
+ wait_until=wait_until,
53
+ ),
54
+ )
55
+
56
+ def check(
57
+ self,
58
+ selector: str,
59
+ *,
60
+ scroll: bool | UnsetType = UNSET,
61
+ timeout: float | UnsetType = UNSET,
62
+ visible: bool | UnsetType = UNSET,
63
+ wait: bool | UnsetType = UNSET,
64
+ ) -> ClickResponse:
65
+ return cast(
66
+ "ClickResponse",
67
+ self._invoke(
68
+ "check",
69
+ selector,
70
+ scroll=scroll,
71
+ timeout=timeout,
72
+ visible=visible,
73
+ wait=wait,
74
+ ),
75
+ )
76
+
77
+ def uncheck(
78
+ self,
79
+ selector: str,
80
+ *,
81
+ scroll: bool | UnsetType = UNSET,
82
+ timeout: float | UnsetType = UNSET,
83
+ visible: bool | UnsetType = UNSET,
84
+ wait: bool | UnsetType = UNSET,
85
+ ) -> ClickResponse:
86
+ return cast(
87
+ "ClickResponse",
88
+ self._invoke(
89
+ "uncheck",
90
+ selector,
91
+ scroll=scroll,
92
+ timeout=timeout,
93
+ visible=visible,
94
+ wait=wait,
95
+ ),
96
+ )
97
+
98
+ def click(
99
+ self,
100
+ selector: str,
101
+ *,
102
+ scroll: bool | UnsetType = UNSET,
103
+ timeout: float | UnsetType = UNSET,
104
+ visible: bool | UnsetType = UNSET,
105
+ wait: bool | UnsetType = UNSET,
106
+ ) -> ClickResponse:
107
+ return cast(
108
+ "ClickResponse",
109
+ self._invoke(
110
+ "click",
111
+ selector,
112
+ scroll=scroll,
113
+ timeout=timeout,
114
+ visible=visible,
115
+ wait=wait,
116
+ ),
117
+ )
118
+
119
+ def set_content(
120
+ self,
121
+ html: str,
122
+ *,
123
+ timeout: float | UnsetType = UNSET,
124
+ wait_until: WaitUntilHistory | UnsetType = UNSET,
125
+ wait_until_all: list[WaitUntilHistory] | UnsetType = UNSET,
126
+ ) -> HTTPResponse | None:
127
+ return cast(
128
+ "HTTPResponse | None",
129
+ self._invoke(
130
+ "set_content",
131
+ html,
132
+ timeout=timeout,
133
+ wait_until=wait_until,
134
+ wait_until_all=wait_until_all,
135
+ ),
136
+ )
137
+
138
+ def cookies(
139
+ self,
140
+ ) -> list[StandardCookie]:
141
+ return cast(
142
+ "list[StandardCookie]",
143
+ self._invoke(
144
+ "cookies",
145
+ ),
146
+ )
147
+
148
+ def go_forward(
149
+ self,
150
+ *,
151
+ timeout: float | UnsetType = UNSET,
152
+ wait_until: WaitUntilHistory | UnsetType = UNSET,
153
+ ) -> HTTPResponse | None:
154
+ return cast(
155
+ "HTTPResponse | None",
156
+ self._invoke(
157
+ "go_forward",
158
+ timeout=timeout,
159
+ wait_until=wait_until,
160
+ ),
161
+ )
162
+
163
+ def goto(
164
+ self,
165
+ url: str,
166
+ *,
167
+ timeout: float | UnsetType = UNSET,
168
+ wait_until: WaitUntilGoto | UnsetType = UNSET,
169
+ wait_until_all: list[WaitUntilGoto] | UnsetType = UNSET,
170
+ referer: str | UnsetType = UNSET,
171
+ referrer_policy: str | UnsetType = UNSET,
172
+ remote_response_metadata: bool | UnsetType = UNSET,
173
+ ) -> HTTPResponse | None:
174
+ return cast(
175
+ "HTTPResponse | None",
176
+ self._invoke(
177
+ "goto",
178
+ url,
179
+ timeout=timeout,
180
+ wait_until=wait_until,
181
+ wait_until_all=wait_until_all,
182
+ referer=referer,
183
+ referrer_policy=referrer_policy,
184
+ remote_response_metadata=remote_response_metadata,
185
+ ),
186
+ )
187
+
188
+ def html(
189
+ self,
190
+ *,
191
+ selector: str | UnsetType = UNSET,
192
+ timeout: float | UnsetType = UNSET,
193
+ visible: bool | UnsetType = UNSET,
194
+ clean: CleanInput | UnsetType = UNSET,
195
+ rewrite: HTMLRewriteInput | UnsetType = UNSET,
196
+ ) -> HTMLResponse:
197
+ return cast(
198
+ "HTMLResponse",
199
+ self._invoke(
200
+ "html",
201
+ selector=selector,
202
+ timeout=timeout,
203
+ visible=visible,
204
+ clean=clean,
205
+ rewrite=rewrite,
206
+ ),
207
+ )
208
+
209
+ def content(
210
+ self,
211
+ ) -> str:
212
+ return cast(
213
+ "str",
214
+ self._invoke(
215
+ "content",
216
+ ),
217
+ )
218
+
219
+ def set_user_agent(
220
+ self,
221
+ user_agent: str,
222
+ ) -> UserAgentResponse:
223
+ return cast(
224
+ "UserAgentResponse",
225
+ self._invoke(
226
+ "set_user_agent",
227
+ user_agent,
228
+ ),
229
+ )
230
+
231
+ def hover(
232
+ self,
233
+ selector: str,
234
+ *,
235
+ scroll: bool | UnsetType = UNSET,
236
+ timeout: float | UnsetType = UNSET,
237
+ visible: bool | UnsetType = UNSET,
238
+ wait: bool | UnsetType = UNSET,
239
+ x: float | UnsetType = UNSET,
240
+ y: float | UnsetType = UNSET,
241
+ ) -> HoverResponse:
242
+ return cast(
243
+ "HoverResponse",
244
+ self._invoke(
245
+ "hover",
246
+ selector,
247
+ scroll=scroll,
248
+ timeout=timeout,
249
+ visible=visible,
250
+ wait=wait,
251
+ x=x,
252
+ y=y,
253
+ ),
254
+ )
255
+
256
+ def set_java_script_enabled(
257
+ self,
258
+ enabled: bool,
259
+ ) -> JavaScriptResponse:
260
+ return cast(
261
+ "JavaScriptResponse",
262
+ self._invoke(
263
+ "set_java_script_enabled",
264
+ enabled,
265
+ ),
266
+ )
267
+
268
+ def live_url(
269
+ self,
270
+ *,
271
+ capture_scale: int | UnsetType = UNSET,
272
+ timeout: float | UnsetType = UNSET,
273
+ interactable: bool | UnsetType = UNSET,
274
+ type: LiveURLStreamType | UnsetType = UNSET,
275
+ quality: int | UnsetType = UNSET,
276
+ resizable: bool | UnsetType = UNSET,
277
+ show_browser_interface: bool | UnsetType = UNSET,
278
+ compressed: bool | UnsetType = UNSET,
279
+ emulate_components: bool | UnsetType = UNSET,
280
+ instructions_layout: InstructionsLayout | UnsetType = UNSET,
281
+ instructions: str | LiveURLInstructions | UnsetType = UNSET,
282
+ instructions_format: InstructionsFormat | UnsetType = UNSET,
283
+ instructions_title: str | UnsetType = UNSET,
284
+ steps: list[str] | UnsetType = UNSET,
285
+ current_step: int | UnsetType = UNSET,
286
+ done_label: str | UnsetType = UNSET,
287
+ fail_label: str | UnsetType = UNSET,
288
+ requester_name: str | UnsetType = UNSET,
289
+ ) -> LiveURLResponse:
290
+ return cast(
291
+ "LiveURLResponse",
292
+ self._invoke(
293
+ "live_url",
294
+ capture_scale=capture_scale,
295
+ timeout=timeout,
296
+ interactable=interactable,
297
+ type=type,
298
+ quality=quality,
299
+ resizable=resizable,
300
+ show_browser_interface=show_browser_interface,
301
+ compressed=compressed,
302
+ emulate_components=emulate_components,
303
+ instructions_layout=instructions_layout,
304
+ instructions=instructions,
305
+ instructions_format=instructions_format,
306
+ instructions_title=instructions_title,
307
+ steps=steps,
308
+ current_step=current_step,
309
+ done_label=done_label,
310
+ fail_label=fail_label,
311
+ requester_name=requester_name,
312
+ ),
313
+ )
314
+
315
+ def map_selector(
316
+ self,
317
+ selector: str,
318
+ *,
319
+ timeout: float | UnsetType = UNSET,
320
+ wait: bool | UnsetType = UNSET,
321
+ ) -> list[MapSelectorResponse]:
322
+ return cast(
323
+ "list[MapSelectorResponse]",
324
+ self._invoke(
325
+ "map_selector",
326
+ selector,
327
+ timeout=timeout,
328
+ wait=wait,
329
+ ),
330
+ )
331
+
332
+ def eval_on_selector_all(
333
+ self,
334
+ selector: str,
335
+ *,
336
+ timeout: float | UnsetType = UNSET,
337
+ wait: bool | UnsetType = UNSET,
338
+ ) -> list[MapSelectorResponse]:
339
+ return cast(
340
+ "list[MapSelectorResponse]",
341
+ self._invoke(
342
+ "eval_on_selector_all",
343
+ selector,
344
+ timeout=timeout,
345
+ wait=wait,
346
+ ),
347
+ )
348
+
349
+ def pdf(
350
+ self,
351
+ *,
352
+ display_header_footer: bool | UnsetType = UNSET,
353
+ format: PDFPageFormat | UnsetType = UNSET,
354
+ footer_template: str | UnsetType = UNSET,
355
+ generate_document_outline: bool | UnsetType = UNSET,
356
+ generate_tagged_pdf: bool | UnsetType = UNSET,
357
+ landscape: bool | UnsetType = UNSET,
358
+ print_background: bool | UnsetType = UNSET,
359
+ omit_background: bool | UnsetType = UNSET,
360
+ scale: float | UnsetType = UNSET,
361
+ timeout: float | UnsetType = UNSET,
362
+ wait_for_images: bool | UnsetType = UNSET,
363
+ wait_for_fonts: bool | UnsetType = UNSET,
364
+ full_page: bool | UnsetType = UNSET,
365
+ width: float | str | UnsetType = UNSET,
366
+ header_template: str | UnsetType = UNSET,
367
+ height: float | str | UnsetType = UNSET,
368
+ margin_bottom: float | str | UnsetType = UNSET,
369
+ margin_left: float | str | UnsetType = UNSET,
370
+ margin_right: float | str | UnsetType = UNSET,
371
+ margin_top: float | str | UnsetType = UNSET,
372
+ page_ranges: str | UnsetType = UNSET,
373
+ prefer_css_page_size: bool | UnsetType = UNSET,
374
+ transfer_mode: str | UnsetType = UNSET,
375
+ path: str | UnsetType = UNSET,
376
+ ) -> bytes:
377
+ return cast(
378
+ "bytes",
379
+ self._invoke(
380
+ "pdf",
381
+ display_header_footer=display_header_footer,
382
+ format=format,
383
+ footer_template=footer_template,
384
+ generate_document_outline=generate_document_outline,
385
+ generate_tagged_pdf=generate_tagged_pdf,
386
+ landscape=landscape,
387
+ print_background=print_background,
388
+ omit_background=omit_background,
389
+ scale=scale,
390
+ timeout=timeout,
391
+ wait_for_images=wait_for_images,
392
+ wait_for_fonts=wait_for_fonts,
393
+ full_page=full_page,
394
+ width=width,
395
+ header_template=header_template,
396
+ height=height,
397
+ margin_bottom=margin_bottom,
398
+ margin_left=margin_left,
399
+ margin_right=margin_right,
400
+ margin_top=margin_top,
401
+ page_ranges=page_ranges,
402
+ prefer_css_page_size=prefer_css_page_size,
403
+ transfer_mode=transfer_mode,
404
+ path=path,
405
+ ),
406
+ )
407
+
408
+ def preferences(
409
+ self,
410
+ *,
411
+ timeout: float | UnsetType = UNSET,
412
+ ) -> DefaultResponse:
413
+ return cast(
414
+ "DefaultResponse",
415
+ self._invoke(
416
+ "preferences",
417
+ timeout=timeout,
418
+ ),
419
+ )
420
+
421
+ def proxy(
422
+ self,
423
+ *,
424
+ network: ProxyNetwork | UnsetType = UNSET,
425
+ country: CountryCode | UnsetType = UNSET,
426
+ city: str | UnsetType = UNSET,
427
+ state: str | UnsetType = UNSET,
428
+ sticky: bool | UnsetType = UNSET,
429
+ preset: str | UnsetType = UNSET,
430
+ server: str | UnsetType = UNSET,
431
+ method: list[Method] | UnsetType = UNSET,
432
+ operator: OperatorType | UnsetType = UNSET,
433
+ type: list[ResourceType] | UnsetType = UNSET,
434
+ url: list[str] | UnsetType = UNSET,
435
+ ) -> ProxyResponse:
436
+ return cast(
437
+ "ProxyResponse",
438
+ self._invoke(
439
+ "proxy",
440
+ network=network,
441
+ country=country,
442
+ city=city,
443
+ state=state,
444
+ sticky=sticky,
445
+ preset=preset,
446
+ server=server,
447
+ method=method,
448
+ operator=operator,
449
+ type=type,
450
+ url=url,
451
+ ),
452
+ )
453
+
454
+ def query_selector(
455
+ self,
456
+ selector: str,
457
+ *,
458
+ timeout: float | UnsetType = UNSET,
459
+ visible: bool | UnsetType = UNSET,
460
+ ) -> ElementHandle | None:
461
+ return cast(
462
+ "ElementHandle | None",
463
+ self._invoke(
464
+ "query_selector",
465
+ selector,
466
+ timeout=timeout,
467
+ visible=visible,
468
+ ),
469
+ )
470
+
471
+ def query_selector_all(
472
+ self,
473
+ selector: str,
474
+ *,
475
+ timeout: float | UnsetType = UNSET,
476
+ visible: bool | UnsetType = UNSET,
477
+ ) -> list[ElementHandle]:
478
+ return cast(
479
+ "list[ElementHandle]",
480
+ self._invoke(
481
+ "query_selector_all",
482
+ selector,
483
+ timeout=timeout,
484
+ visible=visible,
485
+ ),
486
+ )
487
+
488
+ def reconnect(
489
+ self,
490
+ *,
491
+ timeout: float | UnsetType = UNSET,
492
+ ) -> ReconnectionResponse:
493
+ return cast(
494
+ "ReconnectionResponse",
495
+ self._invoke(
496
+ "reconnect",
497
+ timeout=timeout,
498
+ ),
499
+ )
500
+
501
+ def stop_session_recording(
502
+ self,
503
+ ) -> StopSessionRecordingResponse:
504
+ return cast(
505
+ "StopSessionRecordingResponse",
506
+ self._invoke(
507
+ "stop_session_recording",
508
+ ),
509
+ )
510
+
511
+ def reject(
512
+ self,
513
+ *,
514
+ enabled: bool | UnsetType = UNSET,
515
+ method: list[Method] | UnsetType = UNSET,
516
+ operator: OperatorType | UnsetType = UNSET,
517
+ type: list[ResourceType] | UnsetType = UNSET,
518
+ url: list[str] | UnsetType = UNSET,
519
+ regex: list[str] | UnsetType = UNSET,
520
+ ) -> RejectResponse:
521
+ return cast(
522
+ "RejectResponse",
523
+ self._invoke(
524
+ "reject",
525
+ enabled=enabled,
526
+ method=method,
527
+ operator=operator,
528
+ type=type,
529
+ url=url,
530
+ regex=regex,
531
+ ),
532
+ )
533
+
534
+ def reload(
535
+ self,
536
+ *,
537
+ timeout: float | UnsetType = UNSET,
538
+ wait_until: WaitUntilHistory | UnsetType = UNSET,
539
+ ) -> HTTPResponse | None:
540
+ return cast(
541
+ "HTTPResponse | None",
542
+ self._invoke(
543
+ "reload",
544
+ timeout=timeout,
545
+ wait_until=wait_until,
546
+ ),
547
+ )
548
+
549
+ def request(
550
+ self,
551
+ *,
552
+ type: list[ResourceType] | UnsetType = UNSET,
553
+ method: list[Method] | UnsetType = UNSET,
554
+ timeout: float | UnsetType = UNSET,
555
+ url: list[str] | UnsetType = UNSET,
556
+ wait: bool | UnsetType = UNSET,
557
+ operator: OperatorType | UnsetType = UNSET,
558
+ ) -> list[RequestResponse]:
559
+ return cast(
560
+ "list[RequestResponse]",
561
+ self._invoke(
562
+ "request",
563
+ type=type,
564
+ method=method,
565
+ timeout=timeout,
566
+ url=url,
567
+ wait=wait,
568
+ operator=operator,
569
+ ),
570
+ )
571
+
572
+ def response(
573
+ self,
574
+ *,
575
+ status: list[int] | UnsetType = UNSET,
576
+ method: list[Method] | UnsetType = UNSET,
577
+ operator: OperatorType | UnsetType = UNSET,
578
+ timeout: float | UnsetType = UNSET,
579
+ type: list[ResourceType] | UnsetType = UNSET,
580
+ url: list[str] | UnsetType = UNSET,
581
+ wait: bool | UnsetType = UNSET,
582
+ body_encoding: bool | UnsetType = UNSET,
583
+ ) -> list[ResponseResponse]:
584
+ return cast(
585
+ "list[ResponseResponse]",
586
+ self._invoke(
587
+ "response",
588
+ status=status,
589
+ method=method,
590
+ operator=operator,
591
+ timeout=timeout,
592
+ type=type,
593
+ url=url,
594
+ wait=wait,
595
+ body_encoding=body_encoding,
596
+ ),
597
+ )
598
+
599
+ def screenshot(
600
+ self,
601
+ *,
602
+ capture_beyond_viewport: bool | UnsetType = UNSET,
603
+ clip: ScreenshotClip | UnsetType = UNSET,
604
+ from_surface: bool | UnsetType = UNSET,
605
+ full_page: bool | UnsetType = UNSET,
606
+ omit_background: bool | UnsetType = UNSET,
607
+ optimize_for_speed: bool | UnsetType = UNSET,
608
+ quality: float | UnsetType = UNSET,
609
+ selector: str | UnsetType = UNSET,
610
+ type: ScreenshotType | UnsetType = UNSET,
611
+ timeout: float | UnsetType = UNSET,
612
+ wait_for_images: bool | UnsetType = UNSET,
613
+ path: str | UnsetType = UNSET,
614
+ ) -> bytes:
615
+ return cast(
616
+ "bytes",
617
+ self._invoke(
618
+ "screenshot",
619
+ capture_beyond_viewport=capture_beyond_viewport,
620
+ clip=clip,
621
+ from_surface=from_surface,
622
+ full_page=full_page,
623
+ omit_background=omit_background,
624
+ optimize_for_speed=optimize_for_speed,
625
+ quality=quality,
626
+ selector=selector,
627
+ type=type,
628
+ timeout=timeout,
629
+ wait_for_images=wait_for_images,
630
+ path=path,
631
+ ),
632
+ )
633
+
634
+ def scroll(
635
+ self,
636
+ *,
637
+ selector: str | UnsetType = UNSET,
638
+ through_page: bool | UnsetType = UNSET,
639
+ timeout: float | UnsetType = UNSET,
640
+ visible: bool | UnsetType = UNSET,
641
+ wait: bool | UnsetType = UNSET,
642
+ x: float | UnsetType = UNSET,
643
+ y: float | UnsetType = UNSET,
644
+ ) -> ScrollResponse:
645
+ return cast(
646
+ "ScrollResponse",
647
+ self._invoke(
648
+ "scroll",
649
+ selector=selector,
650
+ through_page=through_page,
651
+ timeout=timeout,
652
+ visible=visible,
653
+ wait=wait,
654
+ x=x,
655
+ y=y,
656
+ ),
657
+ )
658
+
659
+ def solve(
660
+ self,
661
+ *,
662
+ type: CaptchaType | UnsetType = UNSET,
663
+ timeout: float | UnsetType = UNSET,
664
+ wait: bool | UnsetType = UNSET,
665
+ ) -> CaptchaResponse:
666
+ return cast(
667
+ "CaptchaResponse",
668
+ self._invoke(
669
+ "solve",
670
+ type=type,
671
+ timeout=timeout,
672
+ wait=wait,
673
+ ),
674
+ )
675
+
676
+ def solve_image_captcha(
677
+ self,
678
+ *,
679
+ captcha_selector: str,
680
+ input_selector: str,
681
+ timeout: float | UnsetType = UNSET,
682
+ ) -> CaptchaResponse:
683
+ return cast(
684
+ "CaptchaResponse",
685
+ self._invoke(
686
+ "solve_image_captcha",
687
+ captcha_selector=captcha_selector,
688
+ input_selector=input_selector,
689
+ timeout=timeout,
690
+ ),
691
+ )
692
+
693
+ def text(
694
+ self,
695
+ *,
696
+ timeout: float | UnsetType = UNSET,
697
+ selector: str | UnsetType = UNSET,
698
+ visible: bool | UnsetType = UNSET,
699
+ clean: CleanInput | UnsetType = UNSET,
700
+ ) -> TextResponse:
701
+ return cast(
702
+ "TextResponse",
703
+ self._invoke(
704
+ "text",
705
+ timeout=timeout,
706
+ selector=selector,
707
+ visible=visible,
708
+ clean=clean,
709
+ ),
710
+ )
711
+
712
+ def eval_on_selector(
713
+ self,
714
+ selector: str,
715
+ ) -> str:
716
+ return cast(
717
+ "str",
718
+ self._invoke(
719
+ "eval_on_selector",
720
+ selector,
721
+ ),
722
+ )
723
+
724
+ def title(
725
+ self,
726
+ ) -> str:
727
+ return cast(
728
+ "str",
729
+ self._invoke(
730
+ "title",
731
+ ),
732
+ )
733
+
734
+ def type(
735
+ self,
736
+ selector: str,
737
+ text: str,
738
+ *,
739
+ delay: list[int] | UnsetType = UNSET,
740
+ interactable: bool | UnsetType = UNSET,
741
+ scroll: bool | UnsetType = UNSET,
742
+ timeout: float | UnsetType = UNSET,
743
+ visible: bool | UnsetType = UNSET,
744
+ wait: bool | UnsetType = UNSET,
745
+ ) -> TypeResponse:
746
+ return cast(
747
+ "TypeResponse",
748
+ self._invoke(
749
+ "type",
750
+ selector,
751
+ text,
752
+ delay=delay,
753
+ interactable=interactable,
754
+ scroll=scroll,
755
+ timeout=timeout,
756
+ visible=visible,
757
+ wait=wait,
758
+ ),
759
+ )
760
+
761
+ def load_secret(
762
+ self,
763
+ ref: str,
764
+ *,
765
+ selector: str | UnsetType = UNSET,
766
+ ) -> LoadSecretResponse:
767
+ return cast(
768
+ "LoadSecretResponse",
769
+ self._invoke(
770
+ "load_secret",
771
+ ref,
772
+ selector=selector,
773
+ ),
774
+ )
775
+
776
+ def url(
777
+ self,
778
+ ) -> str:
779
+ return cast(
780
+ "str",
781
+ self._invoke(
782
+ "url",
783
+ ),
784
+ )
785
+
786
+ def wait_for_navigation(
787
+ self,
788
+ *,
789
+ timeout: float | UnsetType = UNSET,
790
+ wait_until: WaitUntilGoto | UnsetType = UNSET,
791
+ ) -> HTTPResponse:
792
+ return cast(
793
+ "HTTPResponse",
794
+ self._invoke(
795
+ "wait_for_navigation",
796
+ timeout=timeout,
797
+ wait_until=wait_until,
798
+ ),
799
+ )
800
+
801
+ def wait_for_network_idle(
802
+ self,
803
+ *,
804
+ idle_time: float | UnsetType = UNSET,
805
+ concurrency: int | UnsetType = UNSET,
806
+ timeout: float | UnsetType = UNSET,
807
+ ) -> WaitForTimeoutResponse:
808
+ return cast(
809
+ "WaitForTimeoutResponse",
810
+ self._invoke(
811
+ "wait_for_network_idle",
812
+ idle_time=idle_time,
813
+ concurrency=concurrency,
814
+ timeout=timeout,
815
+ ),
816
+ )
817
+
818
+ def wait_for_selector(
819
+ self,
820
+ selector: str,
821
+ *,
822
+ timeout: float | UnsetType = UNSET,
823
+ visible: bool | UnsetType = UNSET,
824
+ hidden: bool | UnsetType = UNSET,
825
+ ) -> WaitForSelectorResponse:
826
+ return cast(
827
+ "WaitForSelectorResponse",
828
+ self._invoke(
829
+ "wait_for_selector",
830
+ selector,
831
+ timeout=timeout,
832
+ visible=visible,
833
+ hidden=hidden,
834
+ ),
835
+ )
836
+
837
+ def wait_for_event(
838
+ self,
839
+ event: str,
840
+ *,
841
+ timeout: float | UnsetType = UNSET,
842
+ ) -> WaitForEvent:
843
+ return cast(
844
+ "WaitForEvent",
845
+ self._invoke(
846
+ "wait_for_event",
847
+ event,
848
+ timeout=timeout,
849
+ ),
850
+ )
851
+
852
+ def watch_event(
853
+ self,
854
+ event: str,
855
+ ) -> WaitForEvent:
856
+ "Start tracking `event` now so a later `wait_for_event` call can return immediately if that event has already fired."
857
+ return cast(
858
+ "WaitForEvent",
859
+ self._invoke(
860
+ "watch_event",
861
+ event,
862
+ ),
863
+ )
864
+
865
+ def set_viewport_size(
866
+ self,
867
+ *,
868
+ width: float,
869
+ height: float,
870
+ device_scale_factor: float | UnsetType = UNSET,
871
+ mobile: bool | UnsetType = UNSET,
872
+ has_touch: bool | UnsetType = UNSET,
873
+ landscape: bool | UnsetType = UNSET,
874
+ ) -> ViewportResponse:
875
+ return cast(
876
+ "ViewportResponse",
877
+ self._invoke(
878
+ "set_viewport_size",
879
+ width=width,
880
+ height=height,
881
+ device_scale_factor=device_scale_factor,
882
+ mobile=mobile,
883
+ has_touch=has_touch,
884
+ landscape=landscape,
885
+ ),
886
+ )
887
+
888
+ def switch_to_window(
889
+ self,
890
+ *,
891
+ url: str | UnsetType = UNSET,
892
+ title: str | UnsetType = UNSET,
893
+ newest: bool | UnsetType = UNSET,
894
+ timeout: float | UnsetType = UNSET,
895
+ wait_until: WaitUntilGoto | UnsetType = UNSET,
896
+ ) -> SwitchWindowResponse:
897
+ return cast(
898
+ "SwitchWindowResponse",
899
+ self._invoke(
900
+ "switch_to_window",
901
+ url=url,
902
+ title=title,
903
+ newest=newest,
904
+ timeout=timeout,
905
+ wait_until=wait_until,
906
+ ),
907
+ )
908
+
909
+ def emulate_media(
910
+ self,
911
+ type: MediaType,
912
+ ) -> EmulateMediaTypeResponse:
913
+ return cast(
914
+ "EmulateMediaTypeResponse",
915
+ self._invoke(
916
+ "emulate_media",
917
+ type,
918
+ ),
919
+ )
920
+
921
+ def fulfill(
922
+ self,
923
+ *,
924
+ url: list[str] | UnsetType = UNSET,
925
+ regex: list[str] | UnsetType = UNSET,
926
+ method: list[Method] | UnsetType = UNSET,
927
+ type: list[ResourceType] | UnsetType = UNSET,
928
+ operator: OperatorType | UnsetType = UNSET,
929
+ status: int | UnsetType = UNSET,
930
+ content_type: str | UnsetType = UNSET,
931
+ body: str | UnsetType = UNSET,
932
+ base64_body: str | UnsetType = UNSET,
933
+ headers: list[HeaderInput] | UnsetType = UNSET,
934
+ ) -> FulfillResponse:
935
+ return cast(
936
+ "FulfillResponse",
937
+ self._invoke(
938
+ "fulfill",
939
+ url=url,
940
+ regex=regex,
941
+ method=method,
942
+ type=type,
943
+ operator=operator,
944
+ status=status,
945
+ content_type=content_type,
946
+ body=body,
947
+ base64_body=base64_body,
948
+ headers=headers,
949
+ ),
950
+ )
951
+
952
+ def markdown(
953
+ self,
954
+ *,
955
+ selector: str | UnsetType = UNSET,
956
+ timeout: float | UnsetType = UNSET,
957
+ visible: bool | UnsetType = UNSET,
958
+ ) -> MarkdownResponse:
959
+ return cast(
960
+ "MarkdownResponse",
961
+ self._invoke(
962
+ "markdown",
963
+ selector=selector,
964
+ timeout=timeout,
965
+ visible=visible,
966
+ ),
967
+ )
968
+
969
+ def close_live_url(
970
+ self,
971
+ live_url_id: str,
972
+ ) -> CloseLiveURLResponse:
973
+ return cast(
974
+ "CloseLiveURLResponse",
975
+ self._invoke(
976
+ "close_live_url",
977
+ live_url_id,
978
+ ),
979
+ )