function BrowserTestBase::xpath

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

43 calls to BrowserTestBase::xpath()
BlockContentListTest::testListing in core/modules/block_content/tests/src/Functional/BlockContentListTest.php
Tests the custom block listing page.
BlockPlaceTest::testPlacingBlocksAdmin in core/modules/block_place/tests/src/Functional/BlockPlaceTest.php
Tests placing blocks as an admin.
BlockPlaceTest::testPlacingBlocksUnprivileged in core/modules/block_place/tests/src/Functional/BlockPlaceTest.php
Tests placing blocks as an unprivileged user.
BlockRemoveDisabledRegionUpdateTest::testUpdateHookN in core/modules/block/tests/src/Functional/Update/BlockRemoveDisabledRegionUpdateTest.php
Tests that block context mapping is updated properly.
CommentAdminTest::testApprovalAdminInterface in core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
Test comment approval functionality through admin/content/comment.

... See full list

File

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

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

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