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()
  4. 8.9.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.

Deprecated

in drupal:11.5.0 and is removed from drupal:13.0.0. Use BrowserTestBase::getNodeElementsByXpath instead.

See also

https://www.drupal.org/node/3589621

8 calls to BrowserTestBase::xpath()
ClaroTest::testPagerAttribute in core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php
Tests pager attribute is present using pager_test.
ContactSitewideTest::testSiteWideContact in core/modules/contact/tests/src/Functional/ContactSitewideTest.php
Tests configuration options and the site-wide contact form.
DefaultMetatagsTest::testMetaTag in core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php
Tests meta tags.
MigrateControllerTest::clickViewsOperationsLink in core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php
Clicks a view link to perform an operation.
OliveroTest::testPagerAttribute in core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php
Tests pager attribute is present using pager_test.

... See full list

File

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

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\Tests

Code

protected function xpath($xpath, array $arguments = []) {
  @trigger_error(__CLASS__ . "::" . __FUNCTION__ . " is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use BrowserTestBase::getNodeElementsByXpath instead. See https://www.drupal.org/node/3589621", E_USER_DEPRECATED);
  return $this->getNodeElementsByXpath($xpath, $arguments);
}

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