MCPcopy Index your code
hub / github.com/microsoft/playwright-python / wait_for_url

Method wait_for_url

playwright/async_api/_generated.py:3597–3644  ·  view source on GitHub ↗

Frame.wait_for_url Waits for the frame to navigate to the given URL. **Usage** ```py await frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation await frame.wait_for_url(\"**/target.html\") ``` Paramet

(
        self,
        url: typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]],
        *,
        wait_until: typing.Optional[
            Literal["commit", "domcontentloaded", "load", "networkidle"]
        ] = None,
        timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
    )

Source from the content-addressed store, hash-verified

3595 )
3596
3597 async def wait_for_url(
3598 self,
3599 url: typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]],
3600 *,
3601 wait_until: typing.Optional[
3602 Literal["commit", "domcontentloaded", "load", "networkidle"]
3603 ] = None,
3604 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
3605 ) -> None:
3606 """Frame.wait_for_url
3607
3608 Waits for the frame to navigate to the given URL.
3609
3610 **Usage**
3611
3612 ```py
3613 await frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation
3614 await frame.wait_for_url(\"**/target.html\")
3615 ```
3616
3617 Parameters
3618 ----------
3619 url : Union[Callable[[str], bool], Pattern[str], str]
3620 A glob pattern, regex pattern, or predicate receiving [URL] to match while waiting for the navigation. Note that if
3621 the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly
3622 equal to the string.
3623 wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
3624 When to consider operation succeeded, defaults to `load`. Events can be either:
3625 - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
3626 - `'load'` - consider operation to be finished when the `load` event is fired.
3627 - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
3628 at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
3629 - `'commit'` - consider operation to be finished when network response is received and the document started
3630 loading.
3631 timeout : Union[float, None]
3632 Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
3633 be changed by using the `browser_context.set_default_navigation_timeout()`,
3634 `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
3635 `page.set_default_timeout()` methods.
3636 """
3637
3638 return mapping.from_maybe_impl(
3639 await self._impl_obj.wait_for_url(
3640 url=self._wrap_handler(url),
3641 waitUntil=wait_until,
3642 timeout=to_milliseconds(timeout),
3643 )
3644 )
3645
3646 async def wait_for_load_state(
3647 self,

Callers

nothing calls this directly

Calls 4

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
wait_for_urlMethod · 0.45
_wrap_handlerMethod · 0.45

Tested by

no test coverage detected