function UiHelperTrait::cssSelectToXpath

Same name in other branches
  1. 9 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::cssSelectToXpath()
  2. 10 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::cssSelectToXpath()

Translates a CSS expression to its XPath equivalent.

The search is relative to the root element (HTML tag normally) of the page.

Parameters

string $selector: CSS selector to use in the search.

bool $html: (optional) Enables HTML support. Disable it for XML documents.

string $prefix: (optional) The prefix for the XPath expression.

Return value

string The equivalent XPath of a CSS expression.

2 calls to UiHelperTrait::cssSelectToXpath()
ResponsiveImageFieldUiTest::testResponsiveImageFormatterUi in core/modules/responsive_image/tests/src/FunctionalJavascript/ResponsiveImageFieldUiTest.php
Tests formatter settings.
UiHelperTrait::click in core/tests/Drupal/Tests/UiHelperTrait.php
Clicks the element with the given CSS selector.

File

core/tests/Drupal/Tests/UiHelperTrait.php, line 527

Class

UiHelperTrait
Provides UI helper methods.

Namespace

Drupal\Tests

Code

protected function cssSelectToXpath($selector, $html = TRUE, $prefix = 'descendant-or-self::') : string {
    return (new CssSelectorConverter($html))->toXPath($selector, $prefix);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.