window
The command to switch the driver's context to the specified Window or Browser Tab.
Syntax
py.switch_to.window(name_or_handle: str) -> Pylenium
py.switch_to.window(index: int) -> Pylenium
Usage
# Switch to a Window by handle
windows = py.window_handles
py.switch_to.window(name_or_handle=windows[1])
# switch to a newly opened Browser Tab by index
py.switch_to.window(index=1)
Arguments
name_or_handle="" (str)
- The name or window handle of the Window to switch toindex=0 (int)
- The index position of the Window Handle
Yields
Pylenium - The current instance of Pylenium so you can chain commands
Last updated