Sanpi\Behatch\Context\BaseContext::findElement PHP Method

findElement() protected method

protected findElement ( $selector, $locator, $index )
    protected function findElement($selector, $locator, $index)
    {
        $page = $this->getSession()->getPage();
        $nodes = $page->findAll($selector, $locator);
        if (!isset($nodes[$index - 1])) {
            throw new \Exception("The {$index} {$selector} '{$locator}' was not found anywhere in the page");
        }
        return $nodes[$index - 1];
    }