Skip to content

browser.open#

Functions#

url(url) #

Open web page by URL.

Parameters:

Name Type Description Default
url str

URL to open, e.g. "https://example.com".

required
Example
1
2
3
4
from browserist import Browser

with Browser() as browser:
    browser.open.url("https://example.com")

url_if_not_current(url, ignore_trailing_slash=True, ignore_parameters=False, ignore_https=False) #

Open a URL if it isn't already the current URL.

Tip

Useful when doing multiple operations on a page where you don't want to reload the page, but either A) only if it isn't a specific URL or B) to ensure that a process is only used on a specific page.

Parameters:

Name Type Description Default
url str

URL to open if not current URL, e.g. "https://example.com".

required
ignore_trailing_slash bool

Ignore whether the URL is "https://example.com" or "https://example.com/".

True
ignore_parameters bool

Ignore parameters in the URL, e.g. ?page=1 in "https://example.com/articles?page=1".

False
ignore_https bool

Ignore whether the URL is "http://example.com" or "https://example.com".

False
Example
1
2
3
4
5
from browserist import Browser

with Browser() as browser:
    browser.open.url("https://example.com")
    browser.open.url_if_not_current("https://example.com/", ignore_trailing_slash=True)