Skip to content

browser.wait.until.url#

Functions#

changes(baseline_url, timeout=None) #

Wait until the browser URL has changed compared to a baseline URL, e.g. after a redirect or form action.

Parameters:

Name Type Description Default
baseline_url str

Baseline URL to compare the new URL to. It's evaluated as any change.

required
timeout float | None

In seconds. Timeout to wait for URL to change. If None, the global timeout setting is used (default 5 seconds).

None
Example
1
2
3
4
5
6
7
from browserist import Browser

with Browser() as browser:
    browser.open.url("https://example.com")
    baseline_url = browser.get.url.current()
    browser.click.button("//xpath/to/button")
    browser.wait.until.url.changes(baseline_url)

contains(url_fragment, timeout=None) #

Wait until the browser URL contains a specified text fragment, e.g. after a redirect or updated query string.

Parameters:

Name Type Description Default
url_fragment str

The URL variable can contain both a fragment (e.g. "?login=true") or a full URL (e.g. "https://example.com?login=true").

required
timeout float | None

In seconds. Timeout to wait for URL to contain the specified fragment. If None, the global timeout setting is used (default 5 seconds).

None
Example
1
2
3
4
5
6
from browserist import Browser

with Browser() as browser:
    browser.open.url("https://example.com")
    browser.click.button("//xpath/to/button")
    browser.wait.until.url.contains("some_page_name")

equals(url, timeout=None) #

Wait until the browser URL has changed to a specific URL, e.g. after a redirect or clicking a button.

Parameters:

Name Type Description Default
url str

Full URL to compare the new URL against. Evaluated as an exact match.

required
timeout float | None

In seconds. Timeout to wait for URL to match the specified URL. If None, the global timeout setting is used (default 5 seconds).

None
Example
1
2
3
4
5
6
from browserist import Browser

with Browser() as browser:
    browser.open.url("https://example.com")
    browser.click.button("//xpath/to/button")
    browser.wait.until.url.equals("https://example.com/some_page_name")