public <T> T waitUntil(int maxSecondsToWait, ExpectedCondition<T> condition) {
        ExpectedCondition<T> cHandlingStale = getConditionIgnoringStaleElement(condition);
        FluentWait<WebDriver> wait = waitDriver().withTimeout(Duration.ofSeconds(maxSecondsToWait));
        return wait.until(cHandlingStale);
    }
public < T > T waitUntil ( int maxSecondsToWait , ExpectedCondition < T > condition ) { ExpectedCondition < T > cHandlingStale = getConditionIgnoringStaleElement ( condition ) ; FluentWait < WebDriver > wait = waitDriver ( ) . withTimeout ( Duration . ofSeconds ( maxSecondsToWait ) ) ; return wait . until ( cHandlingStale ) ; }
Executes condition until it returns a value other than null or false.
It does not forward StaleElementReferenceExceptions, but keeps waiting.
@param maxSecondsToWait number of seconds to wait at most.
@param condition condition to check.
@param <T> return type.
@return result of condition (if not null).
@throws TimeoutException when condition did not give a value to return after maxSecondsToWait.