private double popup ( double seconds ) { // wait for up to XX seconds for the error message double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; WebDriverWait wait = new WebDriverWait ( app . getDriver ( ) , ( long ) seconds , DEFAULT_POLLING_INTERVAL ) ; wait . until ( ExpectedConditions . alertIsPresent ( ) ) ; return Math . min ( ( seconds * 1000 ) - ( end - System . currentTimeMillis ( ) ) , seconds * 1000 ) / 1000 ; }
Wait for a popup to be present and then returns the amount of time that was waited