Sanpi\Behatch\Context\BrowserContext::iWaitSecondsForElement PHP Метод

iWaitSecondsForElement() публичный Метод

Wait for a element
public iWaitSecondsForElement ( $count, $element )
    public function iWaitSecondsForElement($count, $element)
    {
        $found = false;
        $startTime = time();
        do {
            try {
                $node = $this->getSession()->getPage()->findAll('css', $element);
                $this->assertCount(1, $node);
                $found = true;
            } catch (ExpectationException $e) {
                /* Intentionnaly leave blank */
            }
        } while (time() - $startTime < $count);
        if ($found === false) {
            $message = "The element '{$element}' was not found after a {$count} seconds timeout";
            throw new ResponseTextException($message, $this->getSession(), $e);
        }
    }