function BrowserTestBase::xpath

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

341 calls to BrowserTestBase::xpath()
AggregatorAdminTest::testOverviewPage in core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
Tests the overview page.
AggregatorRenderingTest::testBlockLinks in core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php
Adds a feed block to the page and checks its links.
AggregatorRenderingTest::testFeedPage in core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php
Creates a feed and checks that feed's page.
AggregatorTestBase::createFeed in core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php
Creates an aggregator feed.
AjaxFormPageCacheTest::getFormBuildId in core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
Return the build id of the current form.

... 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.