src/Concerns/WaitsForElements.php
/**
     * Wait for the given callback to be true.
     *
     * @param  int  $seconds
     * @param  int  $interval
     * @param  Closure  $callback
     * @param  string|null  $message
     * @return $this
     * @throws TimeOutException
     */
Wait for the given callback to be true.
Wait for the given callback to be true .
public function waitUsing($seconds, $interval, Closure $callback, $message = null)
    {
        $this->pause($interval);
        $started = Carbon::now();
        while (true) {
            try {
                if ($callback()) {
                    break;
                }
            } catch (Exception $e) {
            }
            if ($started->lt(Carbon::now()->subSeconds($seconds))) {
                throw new TimeOutException($message ?: "Waited {$seconds} seconds for callback.");
            }
            $this->pause($interval);
        }
        return $this;
    }
public function waitUsing ( $ seconds , $ interval , Closure $ callback , $ message = null ) { $ this -> pause ( $ interval ) ; $ started = Carbon :: now ( ) ; while ( true ) { try { if ( $ callback ( ) ) { break ; } } catch ( Exception $ e ) { } if ( $ started -> lt ( Carbon :: now ( ) -> subSeconds ( $ seconds ) ) ) { throw new TimeOutException ( $ message ? : " Waited  { $ seconds }  seconds for callback. " ) ; } $ this -> pause ( $ interval ) ; } return $ this ; }
Wait for the given callback to be true.
Wait for the given callback to be true .
//