Skip to content

browser.window.open#

Functions#

new_tab(url=None, name=None, timeout=None) #

Open and switch to new tab in current browser window.

Parameters:

Name Type Description Default
url str | None

If given, the URL will open in the new tab.

None
name str | None

Unique name to identify the tab so you later can switch back to this tab with the browser.window.switch_to("some_name") method.

None
timeout float | None

In seconds. Timeout to wait for the tab. 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.window.open.new_tab("https://example.com", "tab_1")
    browser.window.open.new_tab("https://google.com", "tab_2")
    browser.window.switch_to("tab_1")

new_window(url=None, name=None, timeout=None) #

Open and switch to new browser window.

Parameters:

Name Type Description Default
url str | None

If given, the URL will open in the new window.

None
name str | None

Unique name to identify the window so you later can switch back to this window with the browser.window.switch_to("some_name") method.

None
timeout float | None

In seconds. Timeout to wait for the window. 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.window.open.new_window("https://example.com", "window_1")
    browser.window.open.new_window("https://google.com", "window_2")
    browser.window.switch_to("window_1")