You are here

protected function BrowserTestBase::xpath in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::xpath()
  2. 9 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.

40 calls to BrowserTestBase::xpath()
BlockContentIntegrationTest::assertIds in core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php
Ensures that a list of block_contents appear on the page.
BreadcrumbTest::testBreadCrumbs in core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php
Tests breadcrumbs on node and administrative paths.
CheckboxTest::testFormCheckbox in core/modules/system/tests/src/Functional/Form/CheckboxTest.php
CommentRowTest::testCommentRow in core/modules/comment/tests/src/Functional/Views/CommentRowTest.php
Tests comment row.
DefaultMetatagsTest::testMetaTag in core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php
Tests meta tags.

... See full list

File

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

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);
}