code: public void waitUntil(long waitTime) throws WidgetTimeoutException {
  
          long currentTimeMillis = System.currentTimeMillis();
          long maxRequestTimeout = waitTime;
  
          long endTime = currentTimeMillis + maxRequestTimeout;
  
          while (System.currentTimeMillis() < endTime) {
  
              try {
                  if (timerCallback.execute())
                      return;
                  Thread.sleep(500);
              } catch (InterruptedException e1) {
                  throw new WidgetTimeoutException("The request has timed out", locator);
              } catch (Exception e) {
                  // ignore any other type of Exception and continue
                  logger.debug(" Exception while waiting. " + "Ignoring and continuing to wait. ", e);
              }
          }
  
          throw new WidgetTimeoutException("Timed out performing action " + timerCallback, locator);
      }
docs: Blocks for a given time, or until the associated condition is met. The
  associated condition is checked every half second.
  <p>
  Only an {@link InterruptedException} will prematurely halt the waiting
  process.
  
  @param waitTime
  the time to wait in milliseconds
  @throws WidgetTimeoutException