I used Firefox Driver to open two URL\'s. Whenever I invoke driver, new firefox window is opened. I have to switch between these two windows. How can I do this?
you can use following code to switch between windows based on the window title
private void handleMultipleWindows(String windowTitle) {
Set windows = driver.getWindowHandles();
for (String window : windows) {
driver.switchTo().window(window);
if (driver.getTitle().contains(windowTitle)) {
return;
}
}
}
Similary you could use URL or some other criteria to switch windows.