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

Method wait_for_url

playwright/async_api/_generated.py:9870–9917  ·  view source on GitHub ↗

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

(
        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

9868 )
9869
9870 async def wait_for_url(
9871 self,
9872 url: typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]],
9873 *,
9874 wait_until: typing.Optional[
9875 Literal["commit", "domcontentloaded", "load", "networkidle"]
9876 ] = None,
9877 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
9878 ) -> None:
9879 """Page.wait_for_url
9880
9881 Waits for the main frame to navigate to the given URL.
9882
9883 **Usage**
9884
9885 ```py
9886 await page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation
9887 await page.wait_for_url(\"**/target.html\")
9888 ```
9889
9890 Parameters
9891 ----------
9892 url : Union[Callable[[str], bool], Pattern[str], str]
9893 A glob pattern, regex pattern, or predicate receiving [URL] to match while waiting for the navigation. Note that if
9894 the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly
9895 equal to the string.
9896 wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
9897 When to consider operation succeeded, defaults to `load`. Events can be either:
9898 - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
9899 - `'load'` - consider operation to be finished when the `load` event is fired.
9900 - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
9901 at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
9902 - `'commit'` - consider operation to be finished when network response is received and the document started
9903 loading.
9904 timeout : Union[float, None]
9905 Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
9906 be changed by using the `browser_context.set_default_navigation_timeout()`,
9907 `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
9908 `page.set_default_timeout()` methods.
9909 """
9910
9911 return mapping.from_maybe_impl(
9912 await self._impl_obj.wait_for_url(
9913 url=self._wrap_handler(url),
9914 waitUntil=wait_until,
9915 timeout=to_milliseconds(timeout),
9916 )
9917 )
9918
9919 @typing.overload
9920 async def wait_for_event(

Callers 1

wait_for_urlMethod · 0.45

Calls 3

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
_wrap_handlerMethod · 0.45

Tested by

no test coverage detected