In this blog post, we would like to show you a snippet for ExpectedConditions.numberOfWindowsToBe method.
NumberOfWindowsToBe is a new method in ExpectedConditions class and introduced in Selenium 2.48; it waits until the expected windows count matches with actual WebDriver windows count.
WebDriver driver=new FirefoxDriver();
WebDriverWait wait=new WebDriverWait(driver,10);
driver.get("http://google.com");
driver.findElement(By.linkText("Google")).click();
wait.until(ExpectedConditions.numberOfWindowsToBe(2));
Comments(0)