@@ -2467,7 +2467,8 @@ async def wait_for_selector(
2467
2467
selector : str ,
2468
2468
* ,
2469
2469
state : Literal ["attached" , "detached" , "hidden" , "visible" ] = None ,
2470
- timeout : float = None
2470
+ timeout : float = None ,
2471
+ strict : bool = None
2471
2472
) -> typing .Optional ["ElementHandle" ]:
2472
2473
"""ElementHandle.wait_for_selector
2473
2474
@@ -2503,6 +2504,9 @@ async def wait_for_selector(
2503
2504
timeout : Union[float, NoneType]
2504
2505
Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
2505
2506
using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
2507
+ strict : Union[bool, NoneType]
2508
+ When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
2509
+ element, the call throws an exception.
2506
2510
2507
2511
Returns
2508
2512
-------
@@ -2513,7 +2517,7 @@ async def wait_for_selector(
2513
2517
await self ._async (
2514
2518
"element_handle.wait_for_selector" ,
2515
2519
self ._impl_obj .wait_for_selector (
2516
- selector = selector , state = state , timeout = timeout
2520
+ selector = selector , state = state , timeout = timeout , strict = strict
2517
2521
),
2518
2522
)
2519
2523
)
@@ -3339,8 +3343,8 @@ async def is_hidden(
3339
3343
When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
3340
3344
element, the call throws an exception.
3341
3345
timeout : Union[float, NoneType]
3342
- Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
3343
- using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods .
3346
+ **DEPRECATED** This option is ignored. `frame.is_hidden()` does not wait for the element to become hidden and
3347
+ returns immediately .
3344
3348
3345
3349
Returns
3346
3350
-------
@@ -3373,8 +3377,8 @@ async def is_visible(
3373
3377
When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
3374
3378
element, the call throws an exception.
3375
3379
timeout : Union[float, NoneType]
3376
- Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
3377
- using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods .
3380
+ **DEPRECATED** This option is ignored. `frame.is_visible()` does not wait for the element to become visible and
3381
+ returns immediately .
3378
3382
3379
3383
Returns
3380
3384
-------
@@ -5790,8 +5794,8 @@ async def is_hidden(
5790
5794
When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
5791
5795
element, the call throws an exception.
5792
5796
timeout : Union[float, NoneType]
5793
- Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
5794
- using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods .
5797
+ **DEPRECATED** This option is ignored. `page.is_hidden()` does not wait for the element to become hidden and
5798
+ returns immediately .
5795
5799
5796
5800
Returns
5797
5801
-------
@@ -5824,8 +5828,8 @@ async def is_visible(
5824
5828
When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
5825
5829
element, the call throws an exception.
5826
5830
timeout : Union[float, NoneType]
5827
- Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
5828
- using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods .
5831
+ **DEPRECATED** This option is ignored. `page.is_visible()` does not wait for the element to become visible and
5832
+ returns immediately .
5829
5833
5830
5834
Returns
5831
5835
-------
@@ -6865,6 +6869,8 @@ async def route(
6865
6869
typing .Callable [["Route" ], typing .Any ],
6866
6870
typing .Callable [["Route" , "Request" ], typing .Any ],
6867
6871
],
6872
+ * ,
6873
+ times : int = None
6868
6874
) -> NoneType :
6869
6875
"""Page.route
6870
6876
@@ -6873,6 +6879,9 @@ async def route(
6873
6879
Once routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
6874
6880
6875
6881
> NOTE: The handler will only be called for the first url if the response is a redirect.
6882
+ > NOTE: `page.route()` will not intercept requests intercepted by Service Worker. See
6883
+ [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
6884
+ request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
6876
6885
6877
6886
An example of a naive handler that aborts all image requests:
6878
6887
@@ -6919,13 +6928,17 @@ def handle_route(route):
6919
6928
[`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
6920
6929
handler : Union[Callable[[Route, Request], Any], Callable[[Route], Any]]
6921
6930
handler function to route the request.
6931
+ times : Union[int, NoneType]
6932
+ How often a route should be used. By default it will be used every time.
6922
6933
"""
6923
6934
6924
6935
return mapping .from_maybe_impl (
6925
6936
await self ._async (
6926
6937
"page.route" ,
6927
6938
self ._impl_obj .route (
6928
- url = self ._wrap_handler (url ), handler = self ._wrap_handler (handler )
6939
+ url = self ._wrap_handler (url ),
6940
+ handler = self ._wrap_handler (handler ),
6941
+ times = times ,
6929
6942
),
6930
6943
)
6931
6944
)
@@ -9265,12 +9278,18 @@ async def route(
9265
9278
typing .Callable [["Route" ], typing .Any ],
9266
9279
typing .Callable [["Route" , "Request" ], typing .Any ],
9267
9280
],
9281
+ * ,
9282
+ times : int = None
9268
9283
) -> NoneType :
9269
9284
"""BrowserContext.route
9270
9285
9271
9286
Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
9272
9287
is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
9273
9288
9289
+ > NOTE: `page.route()` will not intercept requests intercepted by Service Worker. See
9290
+ [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
9291
+ request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
9292
+
9274
9293
An example of a naive handler that aborts all image requests:
9275
9294
9276
9295
```py
@@ -9319,13 +9338,17 @@ def handle_route(route):
9319
9338
[`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
9320
9339
handler : Union[Callable[[Route, Request], Any], Callable[[Route], Any]]
9321
9340
handler function to route the request.
9341
+ times : Union[int, NoneType]
9342
+ How often a route should be used. By default it will be used every time.
9322
9343
"""
9323
9344
9324
9345
return mapping .from_maybe_impl (
9325
9346
await self ._async (
9326
9347
"browser_context.route" ,
9327
9348
self ._impl_obj .route (
9328
- url = self ._wrap_handler (url ), handler = self ._wrap_handler (handler )
9349
+ url = self ._wrap_handler (url ),
9350
+ handler = self ._wrap_handler (handler ),
9351
+ times = times ,
9329
9352
),
9330
9353
)
9331
9354
)
@@ -9512,7 +9535,7 @@ async def new_cdp_session(
9512
9535
Parameters
9513
9536
----------
9514
9537
page : Union[Frame, Page]
9515
- Target to create new session for. For backwards-compatability , this parameter is named `page`, but it can be a `Page` or
9538
+ Target to create new session for. For backwards-compatibility , this parameter is named `page`, but it can be a `Page` or
9516
9539
`Frame` type.
9517
9540
9518
9541
Returns
@@ -11559,8 +11582,8 @@ async def is_hidden(self, *, timeout: float = None) -> bool:
11559
11582
Parameters
11560
11583
----------
11561
11584
timeout : Union[float, NoneType]
11562
- Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
11563
- using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods .
11585
+ **DEPRECATED** This option is ignored. `locator.is_hidden()` does not wait for the element to become hidden and
11586
+ returns immediately .
11564
11587
11565
11588
Returns
11566
11589
-------
@@ -11581,8 +11604,8 @@ async def is_visible(self, *, timeout: float = None) -> bool:
11581
11604
Parameters
11582
11605
----------
11583
11606
timeout : Union[float, NoneType]
11584
- Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
11585
- using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods .
11607
+ **DEPRECATED** This option is ignored. `locator.is_visible()` does not wait for the element to become visible and
11608
+ returns immediately .
11586
11609
11587
11610
Returns
11588
11611
-------
0 commit comments