+91 97031 81624 [email protected]

Test automation with Selenium can be a tough task but with the right actionable insights and practical tips, you can be proficient with test automation in Selenium.

In this article, we will understand what are Windows in Selenium and how to handle multiple windows in Selenium WebDriver using Java.

The user scenario being automated here is: Open a new tab and then switch back to the last tab to complete the other pending activities. To do so, use the Action Class approach or using selenium WebDriver interface methods getWindowHandle & getWindowHandles. In such scenarios, Selenium helps handle multiple tabs through WindowHandlers.

Now let’s take an example scenario to understand how it works. The scenario here is as follows:

  1. Open the DemoAutomation URL.
  2. Search for “open separate multiple window” in the search bar.
  3. Save the URL of Download.
  4. Open a new tab.
  5. Switch to the new tab and launch the stored URL.

The code below switches to the opened tab using the Window Handler methods:



Pin It on Pinterest

Share This