Selenium can handle multiple windows using inbuilt method getWindowHandles().
Code for the same as below.
WebDriver driver = new InternetExplorerDriver();
Set<String> allWindows = driver,getWindowHandles();
Code for the same as below.
WebDriver driver = new InternetExplorerDriver();
Set<String> allWindows = driver,getWindowHandles();
for (String allWindow : allWindows ) {
driver.switchTo().window(allWindow);
if (driver.getTitle().equalsIgnoreCase("VIP Database")){
driver.manage().window().maximize();
driver.findElement(By.cssSelector("button")).click();
}
}
No comments:
Post a Comment