You are here

protected function BrowserTestBase::xpath in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::xpath()

Performs an xpath search on the contents of the internal browser.

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

Parameters

string $xpath: The xpath string to use in the search.

array $arguments: An array of arguments with keys in the form ':name' matching the placeholders in the query. The values may be either strings or numeric values.

Return value

\Behat\Mink\Element\NodeElement[] The list of elements matching the xpath expression.

131 calls to BrowserTestBase::xpath()
AreaTest::testRenderAreaToken in core/modules/views/tests/src/Functional/Handler/AreaTest.php
Tests global tokens.
BigPipeTest::assertBigPipePlaceholders in core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
Asserts expected BigPipe placeholders are present and replaced.
BlockContentIntegrationTest::assertIds in core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php
Ensures that a list of block_contents appear on the page.
BlockHtmlTest::testHtml in core/modules/block/tests/src/Functional/BlockHtmlTest.php
Tests for valid HTML for a block.
BlockLanguageTest::testLanguageBlockVisibilityLanguageDelete in core/modules/block/tests/src/Functional/BlockLanguageTest.php
Tests if the visibility settings are removed if the language is deleted.

... See full list

File

core/tests/Drupal/Tests/BrowserTestBase.php, line 609

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\Tests

Code

protected function xpath($xpath, array $arguments = []) {
  $xpath = $this
    ->assertSession()
    ->buildXPathQuery($xpath, $arguments);
  return $this
    ->getSession()
    ->getPage()
    ->findAll('xpath', $xpath);
}