code: public <X> X until(Callable<X> condition) {
      long end = clock.laterBy(timeout.in(MILLISECONDS));
      Exception lastException = null;
  
      while (true) {
        try {
          X toReturn = condition.call();
  
          if (toReturn != null && Boolean.class.equals(toReturn.getClass())) {
            if (Boolean.TRUE.equals(toReturn)) {
              return toReturn;
            }
          } else if (toReturn != null) {
            return toReturn;
          }
        } catch (Exception e) {
          lastException = propagateIfNotIgnored(e);
        }
  
        if (!clock.isNowBefore(end)) {
          String toAppend =
              (message == null) ? " waiting for " + condition.toString() : ": " + message;
  
          String timeoutMessage = String.format("Timed out after %d milliseconds%s",
                                                timeout.in(MILLISECONDS), toAppend);
          throw timeoutException(timeoutMessage, lastException);
        }
  
        try {
          sleeper.sleep(interval);
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
          throw new WebDriverException(e);
        }
      }
    }
docs: Repeatedly applies this instance's input value to the given callable until one of the following
  occurs:
  
  <ol> <li>the function returns neither null nor false.</li> <li>the function throws an unignored
  exception.</li> <li>the timeout expires.</li> <li>the current thread is interrupted.</li>
  </ol>
  
  @param condition the {@link Callable} to evaluate
  @return the callable's return value