Created
March 21, 2012 14:50
-
-
Save cliffdarling/2147818 to your computer and use it in GitHub Desktop.
Selenium Webdriver expected coindition that can be used to wait for a pop-up or other window to open
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.support.ui.ExpectedCondition; | |
/** | |
* Implementation of ExpectedCondition that waits until a second window is opened | |
* Useful when you need to wait for a pop-up window | |
* @author cliff.darling | |
* | |
*/ | |
public class SecondWindowIsOpened implements ExpectedCondition<Boolean> { | |
/** | |
* Default Constructor | |
*/ | |
public SecondWindowIsOpened(){ | |
} | |
/** | |
* {@inheritDoc} | |
* @see com.google.common.base.Function#apply(java.lang.Object) | |
*/ | |
public Boolean apply(WebDriver input) { | |
return input.getWindowHandles().size()>1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment