ugdDiXzQJlIvT

1 Answers
Answered by suresh

Selenium WebDriver Interview Question: How to handle multiple windows in Selenium WebDriver?

Selenium WebDriver Interview Question: How to handle multiple windows in Selenium WebDriver?

When dealing with multiple windows in Selenium WebDriver, you can use the windowHandles() method to get the handles of all open windows. You can then switch between windows using the switchTo().window() method by passing the handle of the window you want to switch to. Here is an example:


// Get handles of all windows
Set handles = driver.getWindowHandles();

// Iterate through each handle and switch to it
for (String handle : handles) {
    driver.switchTo().window(handle);
    // Perform actions on the current window
}

By using this approach, you can effectively handle multiple windows in Selenium WebDriver.

Answer for Question: ugdDiXzQJlIvT