Styrow.dev
Question 25 of 64

How to handle multiple windows in selenium webdriver?

Question

How to handle multiple windows in selenium webdriver?

Answer

In selenium web driver there are methods through which we can handle multiple windows

Driver.getWindowHandles();

 To handle all opened windows by web driver, we can use     "Driver.getWindowHandles()" and then we can switch window from one     window to another in a web application. Its return type is     Iterator<String>.

Driver.getWindowHandle();br> When the site opens, we need to handle the main window by driver.getWindowHandle(). This will handle the current window that uniquely identifies it within this driver instance. Its return type is String.