Wait for Webdriver Windows Count - Codoid
Select Page
Codoid Blog

Wait for Webdriver Windows Count

Being a leading QA Company, we write blogs on all prominent software testing topics and tools using our real-world experience. So stay sharp by subscribing to our Newsletter.

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));
  

Submit a Comment

Your email address will not be published.


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));