4646 parse_result ,
4747 serialize_argument ,
4848)
49+ from playwright ._impl ._locator import Locator
4950from playwright ._impl ._network import Response
5051from playwright ._impl ._wait_helper import WaitHelper
5152
@@ -254,7 +255,9 @@ async def evaluate_handle(
254255 )
255256 )
256257
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 ]:
258261 return from_nullable_channel (
259262 await self ._channel .send ("querySelector" , dict (selector = selector ))
260263 )
@@ -270,33 +273,51 @@ async def query_selector_all(self, selector: str) -> List[ElementHandle]:
270273 async def wait_for_selector (
271274 self ,
272275 selector : str ,
276+ strict : bool = None ,
273277 timeout : float = None ,
274278 state : Literal ["attached" , "detached" , "hidden" , "visible" ] = None ,
275279 ) -> Optional [ElementHandle ]:
276280 return from_nullable_channel (
277281 await self ._channel .send ("waitForSelector" , locals_to_params (locals ()))
278282 )
279283
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 :
281287 return await self ._channel .send ("isChecked" , locals_to_params (locals ()))
282288
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 :
284292 return await self ._channel .send ("isDisabled" , locals_to_params (locals ()))
285293
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 :
287297 return await self ._channel .send ("isEditable" , locals_to_params (locals ()))
288298
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 :
290302 return await self ._channel .send ("isEnabled" , locals_to_params (locals ()))
291303
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 :
293307 return await self ._channel .send ("isHidden" , locals_to_params (locals ()))
294308
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 :
296312 return await self ._channel .send ("isVisible" , locals_to_params (locals ()))
297313
298314 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 ,
300321 ) -> None :
301322 await self ._channel .send (
302323 "dispatchEvent" ,
@@ -308,6 +329,7 @@ async def eval_on_selector(
308329 selector : str ,
309330 expression : str ,
310331 arg : Serializable = None ,
332+ strict : bool = None ,
311333 ) -> Any :
312334 return parse_result (
313335 await self ._channel .send (
@@ -409,6 +431,7 @@ async def click(
409431 timeout : float = None ,
410432 force : bool = None ,
411433 noWaitAfter : bool = None ,
434+ strict : bool = None ,
412435 trial : bool = None ,
413436 ) -> None :
414437 await self ._channel .send ("click" , locals_to_params (locals ()))
@@ -423,6 +446,7 @@ async def dblclick(
423446 timeout : float = None ,
424447 force : bool = None ,
425448 noWaitAfter : bool = None ,
449+ strict : bool = None ,
426450 trial : bool = None ,
427451 ) -> None :
428452 await self ._channel .send ("dblclick" , locals_to_params (locals ()))
@@ -435,6 +459,7 @@ async def tap(
435459 timeout : float = None ,
436460 force : bool = None ,
437461 noWaitAfter : bool = None ,
462+ strict : bool = None ,
438463 trial : bool = None ,
439464 ) -> None :
440465 await self ._channel .send ("tap" , locals_to_params (locals ()))
@@ -445,24 +470,39 @@ async def fill(
445470 value : str ,
446471 timeout : float = None ,
447472 noWaitAfter : bool = None ,
473+ strict : bool = None ,
448474 force : bool = None ,
449475 ) -> None :
450476 await self ._channel .send ("fill" , locals_to_params (locals ()))
451477
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 :
453487 await self ._channel .send ("focus" , locals_to_params (locals ()))
454488
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 ]:
456492 return await self ._channel .send ("textContent" , locals_to_params (locals ()))
457493
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 :
459497 return await self ._channel .send ("innerText" , locals_to_params (locals ()))
460498
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 :
462502 return await self ._channel .send ("innerHTML" , locals_to_params (locals ()))
463503
464504 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
466506 ) -> Optional [str ]:
467507 return await self ._channel .send ("getAttribute" , locals_to_params (locals ()))
468508
@@ -473,6 +513,7 @@ async def hover(
473513 position : Position = None ,
474514 timeout : float = None ,
475515 force : bool = None ,
516+ strict : bool = None ,
476517 trial : bool = None ,
477518 ) -> None :
478519 await self ._channel .send ("hover" , locals_to_params (locals ()))
@@ -483,6 +524,7 @@ async def drag_and_drop(
483524 target : str ,
484525 force : bool = None ,
485526 noWaitAfter : bool = None ,
527+ strict : bool = None ,
486528 timeout : float = None ,
487529 trial : bool = None ,
488530 ) -> None :
@@ -497,6 +539,7 @@ async def select_option(
497539 element : Union ["ElementHandle" , List ["ElementHandle" ]] = None ,
498540 timeout : float = None ,
499541 noWaitAfter : bool = None ,
542+ strict : bool = None ,
500543 force : bool = None ,
501544 ) -> List [str ]:
502545 params = locals_to_params (
@@ -512,6 +555,7 @@ async def select_option(
512555 async def input_value (
513556 self ,
514557 selector : str ,
558+ strict : bool = None ,
515559 timeout : float = None ,
516560 ) -> str :
517561 return await self ._channel .send ("inputValue" , locals_to_params (locals ()))
@@ -520,6 +564,7 @@ async def set_input_files(
520564 self ,
521565 selector : str ,
522566 files : Union [str , Path , FilePayload , List [Union [str , Path ]], List [FilePayload ]],
567+ strict : bool = None ,
523568 timeout : float = None ,
524569 noWaitAfter : bool = None ,
525570 ) -> None :
@@ -532,6 +577,7 @@ async def type(
532577 selector : str ,
533578 text : str ,
534579 delay : float = None ,
580+ strict : bool = None ,
535581 timeout : float = None ,
536582 noWaitAfter : bool = None ,
537583 ) -> None :
@@ -542,6 +588,7 @@ async def press(
542588 selector : str ,
543589 key : str ,
544590 delay : float = None ,
591+ strict : bool = None ,
545592 timeout : float = None ,
546593 noWaitAfter : bool = None ,
547594 ) -> None :
@@ -554,6 +601,7 @@ async def check(
554601 timeout : float = None ,
555602 force : bool = None ,
556603 noWaitAfter : bool = None ,
604+ strict : bool = None ,
557605 trial : bool = None ,
558606 ) -> None :
559607 await self ._channel .send ("check" , locals_to_params (locals ()))
@@ -565,6 +613,7 @@ async def uncheck(
565613 timeout : float = None ,
566614 force : bool = None ,
567615 noWaitAfter : bool = None ,
616+ strict : bool = None ,
568617 trial : bool = None ,
569618 ) -> None :
570619 await self ._channel .send ("uncheck" , locals_to_params (locals ()))
0 commit comments