src/Concerns/WaitsForElements.php
public function waitUntil($script, $seconds = null, $message = null)
    {
        if (! Str::startsWith($script, 'return ')) {
            $script = 'return '.$script;
        }

        if (! Str::endsWith($script, ';')) {
            $script = $script.';';
        }

        return $this->waitUsing($seconds, 100, function () use ($script) {
            return $this->driver->executeScript($script);
        }, $message);
    }
public function waitUntil($script, $seconds = null, $message = null)
    {
        if (! Str::startsWith($script, 'return ')) {
            $script = 'return '.$script;
        }

        if (! Str::endsWith($script, ';')) {
            $script = $script.';';
        }

        return $this->waitUsing($seconds, 100, function () use ($script) {
            return $this->driver->executeScript($script);
        }, $message);
    }
public function waitUntil ( $ script , $ seconds = null , $ message = null ) { if ( ! Str :: startsWith ( $ script , 'return ' ) ) { $ script = 'return ' . $ script ; } if ( ! Str :: endsWith ( $ script , ';' ) ) { $ script = $ script . ';' ; } return $ this -> waitUsing ( $ seconds , 100 , function ( ) use ( $ script ) { return $ this -> driver -> executeScript ( $ script ) ; } , $ message ) ; }
Wait until the given script returns true.

@param  string  $script
@param  int  $seconds
@param  string  $message
@return $this
@throws \Facebook\WebDriver\Exception\TimeOutException
Wait until the given script returns true .