You are here

protected function AssertLegacyTrait::assertFieldByXPath in Drupal 8

Same name and namespace 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.

50 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.
BlockHtmlTest::testHtml in core/modules/block/tests/src/Functional/BlockHtmlTest.php
Tests for valid HTML for a block.

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