SeleniumLibrary
SeleniumLibrary copied to clipboard
Add functionality provided by new Selenium 4 create and/or switch to new window or tab
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:
- Working with windows and tabs
- Selenium WebDriver 4: New Window, New Tab & Screenshots - TestProject Blog post
- Selenium 4 - New Windows and Tab Utilities - SauceLabs Blog post