You are here

protected function WebformAssertLegacyTrait::assertFieldByXPath in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Traits/WebformAssertLegacyTrait.php \Drupal\Tests\webform\Traits\WebformAssertLegacyTrait::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().

3 calls to WebformAssertLegacyTrait::assertFieldByXPath()
WebformAssertLegacyTrait::assertField in tests/src/Traits/WebformAssertLegacyTrait.php
Asserts that a field exists with the given name or ID.
WebformAssertLegacyTrait::assertFieldById in tests/src/Traits/WebformAssertLegacyTrait.php
Asserts that a field exists with the given ID and value.
WebformAssertLegacyTrait::assertFieldByName in tests/src/Traits/WebformAssertLegacyTrait.php
Asserts that a field exists with the given name and value.

File

tests/src/Traits/WebformAssertLegacyTrait.php, line 500

Class

WebformAssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\Tests\webform\Traits

Code

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