code: 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;
      }
docs: @param string $locator
  @param string $selector
  
  @throws \RuntimeException
  @throws NoSuchElement
  
  @return NodeElement