You are here

protected function UiHelperTrait::cssSelectToXpath in Drupal 9

Same name and namespace in other branches
  1. 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/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 576

Class

UiHelperTrait
Provides UI helper methods.

Namespace

Drupal\Tests

Code

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