Skip to content

Add functionality provided by new Selenium 4 create and/or switch to new window or tab #1823

Open
@emanlove

Description

@emanlove

As per the Selenium documentation [1], "Selenium 4 provides a new api NewWindow which creates a new tab (or) new window and automatically switches to it.". This is compared to the previous behavior where "[c]licking a link which opens in a new window [would] focus the new window or tab on screen, but WebDriver will not know which window the Operating System considers active. To work with the new window you will need to switch to it. If you have only two tabs or windows open, and you know which window you start with, by the process of elimination you can loop over both windows or tabs that WebDriver can see, and switch to the one which is not the original."

References:

  1. Working with windows and tabs
  2. Selenium WebDriver 4: New Window, New Tab & Screenshots - TestProject Blog post
  3. Selenium 4 - New Windows and Tab Utilities - SauceLabs Blog post

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions