diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php
index 5570af1673..51610b0231 100644
--- a/core/modules/block/tests/src/Functional/BlockTest.php
+++ b/core/modules/block/tests/src/Functional/BlockTest.php
@@ -223,7 +223,7 @@ public function testBlock() {
$this->assertNoText(t($block['settings[label]']));
// Check for
if the machine name
// is my_block_instance_name.
- $xpath = $this->buildXPathQuery('//div[@id=:id]/*', [':id' => 'block-' . str_replace('_', '-', strtolower($block['id']))]);
+ $xpath = $this->assertSession()->buildXPathQuery('//div[@id=:id]/*', [':id' => 'block-' . str_replace('_', '-', strtolower($block['id']))]);
$this->assertNoFieldByXPath($xpath, FALSE, 'Block found in no regions.');
// Test deleting the block from the edit form.
@@ -349,7 +349,7 @@ public function moveBlockToRegion(array $block, $region) {
$this->assertText(t($block['settings[label]']), 'Block successfully being displayed on the page.');
// Confirm that the custom block was found at the proper region.
- $xpath = $this->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', [
+ $xpath = $this->assertSession()->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', [
':region-class' => 'region region-' . Html::getClass($region),
':block-id' => 'block-' . str_replace('_', '-', strtolower($block['id'])),
]);
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
index cc7bc5fe00..520c67b89b 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
@@ -390,7 +390,7 @@ protected function createEntityReferenceField($target_type, $bundles = []) {
* An array of expected options.
*/
protected function assertFieldSelectOptions($name, array $expected_options) {
- $xpath = $this->buildXPathQuery('//select[@name=:name]', [':name' => $name]);
+ $xpath = $this->assertSession()->buildXPathQuery('//select[@name=:name]', [':name' => $name]);
$fields = $this->xpath($xpath);
if ($fields) {
$field = $fields[0];
diff --git a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
index d80699f9a6..0a767259d2 100644
--- a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
+++ b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
@@ -250,7 +250,7 @@ public function testFieldAdminHandler() {
* An array of expected options.
*/
protected function assertFieldSelectOptions($name, array $expected_options) {
- $xpath = $this->buildXPathQuery('//select[@name=:name]', [':name' => $name]);
+ $xpath = $this->assertSession()->buildXPathQuery('//select[@name=:name]', [':name' => $name]);
$fields = $this->xpath($xpath);
if ($fields) {
$field = $fields[0];
diff --git a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php
index 6a52239283..71fdb980f4 100644
--- a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php
@@ -293,7 +293,7 @@ public function assertNodeViewTextHelper(EntityInterface $node, $view_mode, $tex
* An array of expected options.
*/
protected function assertFieldSelectOptions($name, array $expected_options) {
- $xpath = $this->buildXPathQuery('//select[@name=:name]', [':name' => $name]);
+ $xpath = $this->assertSession()->buildXPathQuery('//select[@name=:name]', [':name' => $name]);
$fields = $this->xpath($xpath);
if ($fields) {
$field = $fields[0];
diff --git a/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php
index 3e71abc378..2af8f746ca 100644
--- a/core/modules/forum/tests/src/Functional/ForumTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumTest.php
@@ -205,7 +205,7 @@ public function testForum() {
$forum_arg = [':forum' => 'forum-list-' . $this->forum['tid']];
// Topics cell contains number of topics and number of unread topics.
- $xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="forum__topics"]', $forum_arg);
+ $xpath = $this->assertSession()->buildXPathQuery('//tr[@id=:forum]//td[@class="forum__topics"]', $forum_arg);
$topics = $this->xpath($xpath);
$topics = trim($topics[0]->getText());
// The extracted text contains the number of topics (6) and new posts
diff --git a/core/modules/system/tests/src/Functional/Menu/AssertMenuActiveTrailTrait.php b/core/modules/system/tests/src/Functional/Menu/AssertMenuActiveTrailTrait.php
index 7eb8394e94..f525f86441 100644
--- a/core/modules/system/tests/src/Functional/Menu/AssertMenuActiveTrailTrait.php
+++ b/core/modules/system/tests/src/Functional/Menu/AssertMenuActiveTrailTrait.php
@@ -36,7 +36,7 @@ protected function assertMenuActiveTrail($tree, $last_active) {
':href' => Url::fromUri('base:' . $link_path)->toString(),
':title' => $link_title,
];
- $xpath .= $this->buildXPathQuery($part_xpath, $part_args);
+ $xpath .= $this->assertSession()->buildXPathQuery($part_xpath, $part_args);
$i++;
}
$elements = $this->xpath($xpath);
diff --git a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php
index a270c71761..874b0d610f 100644
--- a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php
@@ -188,7 +188,7 @@ protected function parseContent($content) {
*/
protected function xpathContent($content, $xpath, array $arguments = []) {
if ($elements = $this->parseContent($content)) {
- $xpath = $this->buildXPathQuery($xpath, $arguments);
+ $xpath = $this->assertSession()->buildXPathQuery($xpath, $arguments);
$result = $elements->xpath($xpath);
// Some combinations of PHP / libxml versions return an empty array
// instead of the documented FALSE. Forcefully convert any falsish values
diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
index efe4615eac..da0667e449 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
@@ -231,12 +231,12 @@ public function testExposedBlock() {
$this->assertNoText($view->getTitle(), 'Block title was not displayed.');
// Test there is an exposed form in a block.
- $xpath = $this->buildXPathQuery('//div[@id=:id]/form/@id', [':id' => Html::getUniqueId('block-' . $block->id())]);
+ $xpath = $this->assertSession()->buildXPathQuery('//div[@id=:id]/form/@id', [':id' => Html::getUniqueId('block-' . $block->id())]);
$result = $this->xpath($xpath);
$this->assertCount(1, $result);
// Test there is not an exposed form in the view page content area.
- $xpath = $this->buildXPathQuery('//div[@class="view-content"]/form/@id', [':id' => Html::getUniqueId('block-' . $block->id())]);
+ $xpath = $this->assertSession()->buildXPathQuery('//div[@class="view-content"]/form/@id', [':id' => Html::getUniqueId('block-' . $block->id())]);
$this->assertNoFieldByXpath($xpath, $this->getExpectedExposedFormId($view), 'No exposed form found in views content region.');
// Test there is only one views exposed form on the page.
diff --git a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
index 8115a13172..9cca54937e 100644
--- a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
+++ b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
@@ -802,7 +802,7 @@ protected function buildXPathQuery($xpath, array $args = []) {
*/
protected function constructFieldXpath($attribute, $value) {
$xpath = '//textarea[@' . $attribute . '=:value]|//input[@' . $attribute . '=:value]|//select[@' . $attribute . '=:value]';
- return $this->buildXPathQuery($xpath, [':value' => $value]);
+ return $this->assertSession()->buildXPathQuery($xpath, [':value' => $value]);
}
/**