You are here

public function SelectorsHandler::selectorToXpath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/src/Selector/SelectorsHandler.php \Behat\Mink\Selector\SelectorsHandler::selectorToXpath()

Translates selector with specified name to XPath.

Parameters

string $selector selector engine name (registered):

string|array $locator selector locator (an array or a string depending of the selector being used):

Return value

string

File

vendor/behat/mink/src/Selector/SelectorsHandler.php, line 101

Class

SelectorsHandler
Selectors handler.

Namespace

Behat\Mink\Selector

Code

public function selectorToXpath($selector, $locator) {
  if ('xpath' === $selector) {
    if (!is_string($locator)) {
      throw new \InvalidArgumentException('The xpath selector expects to get a string as locator');
    }
    return $locator;
  }
  return $this
    ->getSelector($selector)
    ->translateToXPath($locator);
}