function AssertLegacyTrait::constructFieldXpath
Same name in other branches
- 8.9.x core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::constructFieldXpath()
Helper: Constructs an XPath for the given set of attributes and value.
Parameters
string $attribute: Field attributes.
string $value: Value of field.
Return value
string XPath for specified values.
Deprecated
in drupal:8.5.0 and is removed from drupal:10.0.0. Use $this->getSession()->getPage()->findField() instead.
See also
https://www.drupal.org/node/3129738
1 call to AssertLegacyTrait::constructFieldXpath()
- AssertLegacyTraitTest::testConstructFieldXpath in core/
tests/ Drupal/ Tests/ Core/ Assert/ AssertLegacyTraitTest.php - @covers ::constructFieldXpath
File
-
core/
tests/ Drupal/ FunctionalTests/ AssertLegacyTrait.php, line 954
Class
- AssertLegacyTrait
- Provides convenience methods for assertions in browser tests.
Namespace
Drupal\FunctionalTestsCode
protected function constructFieldXpath($attribute, $value) {
@trigger_error('AssertLegacyTrait::constructFieldXpath() is deprecated in drupal:8.5.0 and is removed from drupal:10.0.0. Use $this->getSession()->getPage()->findField() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
$xpath = '//textarea[@' . $attribute . '=:value]|//input[@' . $attribute . '=:value]|//select[@' . $attribute . '=:value]';
return $this->assertSession()
->buildXPathQuery($xpath, [
':value' => $value,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.