balin / com.github.epadronu.balin.core / WaitingSupport / waitFor

waitFor

open fun <T> waitFor(timeOutInSeconds: Long = configurationSetup.waitForTimeOutTimeInSeconds, sleepInMillis: Long = configurationSetup.waitForSleepTimeInMilliseconds, isTrue: () -> ExpectedCondition<T>): T

Repeatedly applies the underlying driver to the given function until one of the following occurs:

  1. the function returns neither null nor false
  2. the function throws an unignored exception
  3. the timeout expires
  4. the current thread is interrupted

Parameters

T - the function's expected return type.

timeOutInSeconds - the timeout in seconds when an expectation is called.

sleepInMillis - the duration in milliseconds to sleep between polls.

isTrue - the parameter to pass to the ExpectedCondition.

Return
The function's return value if the function returned something different from null or false before the timeout expired.