46
46
parse_result ,
47
47
serialize_argument ,
48
48
)
49
+ from playwright ._impl ._locator import Locator
49
50
from playwright ._impl ._network import Response
50
51
from playwright ._impl ._wait_helper import WaitHelper
51
52
@@ -254,7 +255,9 @@ async def evaluate_handle(
254
255
)
255
256
)
256
257
257
- async def query_selector (self , selector : str ) -> Optional [ElementHandle ]:
258
+ async def query_selector (
259
+ self , selector : str , strict : bool = None
260
+ ) -> Optional [ElementHandle ]:
258
261
return from_nullable_channel (
259
262
await self ._channel .send ("querySelector" , dict (selector = selector ))
260
263
)
@@ -270,33 +273,51 @@ async def query_selector_all(self, selector: str) -> List[ElementHandle]:
270
273
async def wait_for_selector (
271
274
self ,
272
275
selector : str ,
276
+ strict : bool = None ,
273
277
timeout : float = None ,
274
278
state : Literal ["attached" , "detached" , "hidden" , "visible" ] = None ,
275
279
) -> Optional [ElementHandle ]:
276
280
return from_nullable_channel (
277
281
await self ._channel .send ("waitForSelector" , locals_to_params (locals ()))
278
282
)
279
283
280
- async def is_checked (self , selector : str , timeout : float = None ) -> bool :
284
+ async def is_checked (
285
+ self , selector : str , strict : bool = None , timeout : float = None
286
+ ) -> bool :
281
287
return await self ._channel .send ("isChecked" , locals_to_params (locals ()))
282
288
283
- async def is_disabled (self , selector : str , timeout : float = None ) -> bool :
289
+ async def is_disabled (
290
+ self , selector : str , strict : bool = None , timeout : float = None
291
+ ) -> bool :
284
292
return await self ._channel .send ("isDisabled" , locals_to_params (locals ()))
285
293
286
- async def is_editable (self , selector : str , timeout : float = None ) -> bool :
294
+ async def is_editable (
295
+ self , selector : str , strict : bool = None , timeout : float = None
296
+ ) -> bool :
287
297
return await self ._channel .send ("isEditable" , locals_to_params (locals ()))
288
298
289
- async def is_enabled (self , selector : str , timeout : float = None ) -> bool :
299
+ async def is_enabled (
300
+ self , selector : str , strict : bool = None , timeout : float = None
301
+ ) -> bool :
290
302
return await self ._channel .send ("isEnabled" , locals_to_params (locals ()))
291
303
292
- async def is_hidden (self , selector : str , timeout : float = None ) -> bool :
304
+ async def is_hidden (
305
+ self , selector : str , strict : bool = None , timeout : float = None
306
+ ) -> bool :
293
307
return await self ._channel .send ("isHidden" , locals_to_params (locals ()))
294
308
295
- async def is_visible (self , selector : str , timeout : float = None ) -> bool :
309
+ async def is_visible (
310
+ self , selector : str , strict : bool = None , timeout : float = None
311
+ ) -> bool :
296
312
return await self ._channel .send ("isVisible" , locals_to_params (locals ()))
297
313
298
314
async def dispatch_event (
299
- self , selector : str , type : str , eventInit : Dict = None , timeout : float = None
315
+ self ,
316
+ selector : str ,
317
+ type : str ,
318
+ eventInit : Dict = None ,
319
+ strict : bool = None ,
320
+ timeout : float = None ,
300
321
) -> None :
301
322
await self ._channel .send (
302
323
"dispatchEvent" ,
@@ -308,6 +329,7 @@ async def eval_on_selector(
308
329
selector : str ,
309
330
expression : str ,
310
331
arg : Serializable = None ,
332
+ strict : bool = None ,
311
333
) -> Any :
312
334
return parse_result (
313
335
await self ._channel .send (
@@ -409,6 +431,7 @@ async def click(
409
431
timeout : float = None ,
410
432
force : bool = None ,
411
433
noWaitAfter : bool = None ,
434
+ strict : bool = None ,
412
435
trial : bool = None ,
413
436
) -> None :
414
437
await self ._channel .send ("click" , locals_to_params (locals ()))
@@ -423,6 +446,7 @@ async def dblclick(
423
446
timeout : float = None ,
424
447
force : bool = None ,
425
448
noWaitAfter : bool = None ,
449
+ strict : bool = None ,
426
450
trial : bool = None ,
427
451
) -> None :
428
452
await self ._channel .send ("dblclick" , locals_to_params (locals ()))
@@ -435,6 +459,7 @@ async def tap(
435
459
timeout : float = None ,
436
460
force : bool = None ,
437
461
noWaitAfter : bool = None ,
462
+ strict : bool = None ,
438
463
trial : bool = None ,
439
464
) -> None :
440
465
await self ._channel .send ("tap" , locals_to_params (locals ()))
@@ -445,24 +470,39 @@ async def fill(
445
470
value : str ,
446
471
timeout : float = None ,
447
472
noWaitAfter : bool = None ,
473
+ strict : bool = None ,
448
474
force : bool = None ,
449
475
) -> None :
450
476
await self ._channel .send ("fill" , locals_to_params (locals ()))
451
477
452
- async def focus (self , selector : str , timeout : float = None ) -> None :
478
+ def locator (
479
+ self ,
480
+ selector : str ,
481
+ ) -> Locator :
482
+ return Locator (self , selector )
483
+
484
+ async def focus (
485
+ self , selector : str , strict : bool = None , timeout : float = None
486
+ ) -> None :
453
487
await self ._channel .send ("focus" , locals_to_params (locals ()))
454
488
455
- async def text_content (self , selector : str , timeout : float = None ) -> Optional [str ]:
489
+ async def text_content (
490
+ self , selector : str , strict : bool = None , timeout : float = None
491
+ ) -> Optional [str ]:
456
492
return await self ._channel .send ("textContent" , locals_to_params (locals ()))
457
493
458
- async def inner_text (self , selector : str , timeout : float = None ) -> str :
494
+ async def inner_text (
495
+ self , selector : str , strict : bool = None , timeout : float = None
496
+ ) -> str :
459
497
return await self ._channel .send ("innerText" , locals_to_params (locals ()))
460
498
461
- async def inner_html (self , selector : str , timeout : float = None ) -> str :
499
+ async def inner_html (
500
+ self , selector : str , strict : bool = None , timeout : float = None
501
+ ) -> str :
462
502
return await self ._channel .send ("innerHTML" , locals_to_params (locals ()))
463
503
464
504
async def get_attribute (
465
- self , selector : str , name : str , timeout : float = None
505
+ self , selector : str , name : str , strict : bool = None , timeout : float = None
466
506
) -> Optional [str ]:
467
507
return await self ._channel .send ("getAttribute" , locals_to_params (locals ()))
468
508
@@ -473,6 +513,7 @@ async def hover(
473
513
position : Position = None ,
474
514
timeout : float = None ,
475
515
force : bool = None ,
516
+ strict : bool = None ,
476
517
trial : bool = None ,
477
518
) -> None :
478
519
await self ._channel .send ("hover" , locals_to_params (locals ()))
@@ -483,6 +524,7 @@ async def drag_and_drop(
483
524
target : str ,
484
525
force : bool = None ,
485
526
noWaitAfter : bool = None ,
527
+ strict : bool = None ,
486
528
timeout : float = None ,
487
529
trial : bool = None ,
488
530
) -> None :
@@ -497,6 +539,7 @@ async def select_option(
497
539
element : Union ["ElementHandle" , List ["ElementHandle" ]] = None ,
498
540
timeout : float = None ,
499
541
noWaitAfter : bool = None ,
542
+ strict : bool = None ,
500
543
force : bool = None ,
501
544
) -> List [str ]:
502
545
params = locals_to_params (
@@ -512,6 +555,7 @@ async def select_option(
512
555
async def input_value (
513
556
self ,
514
557
selector : str ,
558
+ strict : bool = None ,
515
559
timeout : float = None ,
516
560
) -> str :
517
561
return await self ._channel .send ("inputValue" , locals_to_params (locals ()))
@@ -520,6 +564,7 @@ async def set_input_files(
520
564
self ,
521
565
selector : str ,
522
566
files : Union [str , Path , FilePayload , List [Union [str , Path ]], List [FilePayload ]],
567
+ strict : bool = None ,
523
568
timeout : float = None ,
524
569
noWaitAfter : bool = None ,
525
570
) -> None :
@@ -532,6 +577,7 @@ async def type(
532
577
selector : str ,
533
578
text : str ,
534
579
delay : float = None ,
580
+ strict : bool = None ,
535
581
timeout : float = None ,
536
582
noWaitAfter : bool = None ,
537
583
) -> None :
@@ -542,6 +588,7 @@ async def press(
542
588
selector : str ,
543
589
key : str ,
544
590
delay : float = None ,
591
+ strict : bool = None ,
545
592
timeout : float = None ,
546
593
noWaitAfter : bool = None ,
547
594
) -> None :
@@ -554,6 +601,7 @@ async def check(
554
601
timeout : float = None ,
555
602
force : bool = None ,
556
603
noWaitAfter : bool = None ,
604
+ strict : bool = None ,
557
605
trial : bool = None ,
558
606
) -> None :
559
607
await self ._channel .send ("check" , locals_to_params (locals ()))
@@ -565,6 +613,7 @@ async def uncheck(
565
613
timeout : float = None ,
566
614
force : bool = None ,
567
615
noWaitAfter : bool = None ,
616
+ strict : bool = None ,
568
617
trial : bool = None ,
569
618
) -> None :
570
619
await self ._channel .send ("uncheck" , locals_to_params (locals ()))
0 commit comments