Software Development and QA Tips By QASource Experts

How To Handle Multiple Windows in Selenium Webdriver?

Written by Dapheny Murphy | Sep 19, 2022 4:00:00 PM

Selenium is an efficient tool and it is most widely used by major software QA companies.

There are some inbuilt methods available to handle multiple windows opened.

Below are the methods that work best to handle this scenario:

  1. getWindowHandles(): This method is used to get the handle of all the opened windows. This method returns a set of strings.
  2. getWindowHandle(): This method gets the window handle of a currently opened window.
  3. switchTo(): This method is used to switch the controller to the desired window.
  4. action(): This method is used to perform the desired action.