src/Context/RawPageContext.php
public function element($locator, $selector)
    {
        $map = [
            'button' => 'Button',
            'field' => 'Field',
            'text' => 'ByText',
            'css' => 'ByCss',
            '*' => 'Element',
        ];

        if (!isset($map[$locator])) {
            throw new \RuntimeException(sprintf('Locator "%s" was not specified.'));
        }

        $selector = t($selector);
        $element = $this->{'find' . $map[$locator]}($selector);
        $this->throwNoSuchElementException($selector, $element);

        return $element;
    }
public function element($locator, $selector)
    {
        $map = [
            'button' => 'Button',
            'field' => 'Field',
            'text' => 'ByText',
            'css' => 'ByCss',
            '*' => 'Element',
        ];

        if (!isset($map[$locator])) {
            throw new \RuntimeException(sprintf('Locator "%s" was not specified.'));
        }

        $selector = t($selector);
        $element = $this->{'find' . $map[$locator]}($selector);
        $this->throwNoSuchElementException($selector, $element);

        return $element;
    }
@param string $locator
@param string $selector

@throws \RuntimeException
@throws NoSuchElement

@return NodeElement