You are here

public function SelectorsContext::registerSelectors in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.5

Same name and namespace in other branches
  1. 8.8 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::registerSelectors()
  2. 8.4 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::registerSelectors()
  3. 8.6 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::registerSelectors()
  4. 8.7 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::registerSelectors()
  5. 9.0.x tests/features/bootstrap/SelectorsContext.php \SelectorsContext::registerSelectors()

@BeforeStep @javascript

File

tests/features/bootstrap/SelectorsContext.php, line 116

Class

SelectorsContext
Defines application features from the specific context.

Code

public function registerSelectors() {
  $selectorHandler = $this
    ->getSession()
    ->getSelectorsHandler()
    ->getSelector('named');

  // Register selector name for all CSS selectors.
  $css = new CssSelector();
  foreach ($this->cssSelectors as $name => $selector) {
    $selectorHandler
      ->registerNamedXpath($name, $css
      ->translateToXPath($selector));
  }

  // Register selector name for all XPath selectors.
  foreach ($this->xpathSelectors as $name => $selector) {
    $selectorHandler
      ->registerNamedXpath($name, $selector);
  }
}