function AssertLegacyTrait::assertFieldByXPath

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertFieldByXPath()

Asserts that a field exists in the current page by the given XPath.

Parameters

string $xpath: XPath used to find the field.

string $value: (optional) Value of the field to assert. You may pass in NULL (default) to skip checking the actual value, while still checking that the field exists.

string $message: (optional) A message to display with the assertion. Do not translate messages with t().

Deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use $this->xpath() instead and check the values directly in the test.

65 calls to AssertLegacyTrait::assertFieldByXPath()
AssertLegacyTrait::assertField in core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
Asserts that a field exists with the given name or ID.
AssertLegacyTrait::assertFieldById in core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
Asserts that a field exists with the given ID and value.
AssertLegacyTrait::assertFieldByName in core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
Asserts that a field exists with the given name and value.
BlockContentCreationTest::testBlockContentCreationMultipleViewModes in core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
Creates a "Basic page" block with multiple view modes.
BlockContentListTest::testListing in core/modules/block_content/tests/src/Functional/BlockContentListTest.php
Tests the custom block listing page.

... See full list

File

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php, line 549

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertFieldByXPath($xpath, $value = NULL, $message = '') {
    $fields = $this->xpath($xpath);
    $this->assertFieldsByValue($fields, $value, $message);
}

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