diff --git a/core/modules/block/tests/src/Functional/BlockHtmlTest.php b/core/modules/block/tests/src/Functional/BlockHtmlTest.php
index 8944c7a3cbf218cf173edaa9fe7f2e35c4cc2534..f6e8a284194dbfc51d211a32c8894cf8f0bb0cb5 100644
--- a/core/modules/block/tests/src/Functional/BlockHtmlTest.php
+++ b/core/modules/block/tests/src/Functional/BlockHtmlTest.php
@@ -45,7 +45,7 @@ public function testHtml() {
 
     // Ensure that a block's ID is converted to an HTML valid ID, and that
     // block-specific attributes are added to the same DOM element.
-    $this->assertFieldByXPath('//div[@id="block-test-html-block" and @data-custom-attribute="foo"]', NULL, 'HTML ID and attributes for test block are valid and on the same DOM element.');
+    $this->assertSession()->elementExists('xpath', '//div[@id="block-test-html-block" and @data-custom-attribute="foo"]');
 
     // Ensure expected markup for a menu block.
     $elements = $this->xpath('//nav[contains(@class, :nav-class)]/ul[contains(@class, :ul-class)]/li', [':nav-class' => 'block-menu', ':ul-class' => 'menu']);
diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php
index a7ab47a4c8a43b27b94b25bea8065b378723546e..773694db6f00161b10adb664ce7a0945bda5b3fd 100644
--- a/core/modules/block/tests/src/Functional/BlockTest.php
+++ b/core/modules/block/tests/src/Functional/BlockTest.php
@@ -224,7 +224,7 @@ public function testBlock() {
     // Check for <div id="block-my-block-instance-name"> if the machine name
     // is my_block_instance_name.
     $xpath = $this->assertSession()->buildXPathQuery('//div[@id=:id]/*', [':id' => 'block-' . str_replace('_', '-', strtolower($block['id']))]);
-    $this->assertNoFieldByXPath($xpath, FALSE, 'Block found in no regions.');
+    $this->assertSession()->elementNotExists('xpath', $xpath);
 
     // Test deleting the block from the edit form.
     $this->drupalGet('admin/structure/block/manage/' . $block['id']);
@@ -352,7 +352,7 @@ public function moveBlockToRegion(array $block, $region) {
       ':region-class' => 'region region-' . Html::getClass($region),
       ':block-id' => 'block-' . str_replace('_', '-', strtolower($block['id'])),
     ]);
-    $this->assertFieldByXPath($xpath, NULL, t('Block found in %region_name region.', ['%region_name' => Html::getClass($region)]));
+    $this->assertSession()->elementExists('xpath', $xpath);
   }
 
   /**
diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php
index 008a1326470ca2c5738620cf603bc07f6b9c9366..db5761d4a989a426a6e87854a33acba99caa4c04 100644
--- a/core/modules/block/tests/src/Functional/BlockUiTest.php
+++ b/core/modules/block/tests/src/Functional/BlockUiTest.php
@@ -270,7 +270,7 @@ public function testContextAwareBlocks() {
     // Tests that conditions with missing context are not displayed.
     $this->drupalGet('admin/structure/block/manage/testcontextawareblock');
     $this->assertNoRaw('No existing type');
-    $this->assertNoFieldByXPath('//*[@name="visibility[condition_test_no_existing_type][negate]"]');
+    $this->assertSession()->elementNotExists('xpath', '//*[@name="visibility[condition_test_no_existing_type][negate]"]');
   }
 
   /**
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
index 54dc07e3f2140ed6d91d75b2b0f410fab6c0d23e..aad9519b7259af585120b0a7257824c2985ad093 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
@@ -65,7 +65,7 @@ public function testBlockContentCreation() {
     ]));
 
     // Check that the view mode setting is hidden because only one exists.
-    $this->assertNoFieldByXPath('//select[@name="settings[view_mode]"]', NULL, 'View mode setting hidden because only one exists');
+    $this->assertSession()->fieldNotExists('settings[view_mode]');
 
     // Check that the block exists in the database.
     $blocks = \Drupal::entityTypeManager()
@@ -140,7 +140,7 @@ public function testBlockContentCreationMultipleViewModes() {
 
     // Check that the view mode setting is shown because more than one exists.
     $this->drupalGet('admin/structure/block/manage/testblock');
-    $this->assertFieldByXPath('//select[@name="settings[view_mode]"]', NULL, 'View mode setting shown because multiple exist');
+    $this->assertSession()->fieldExists('settings[view_mode]');
 
     // Change the view mode.
     $view_mode['region'] = 'content';
@@ -149,7 +149,7 @@ public function testBlockContentCreationMultipleViewModes() {
 
     // Go to the configure page and verify the view mode has changed.
     $this->drupalGet('admin/structure/block/manage/testblock');
-    $this->assertFieldByXPath('//select[@name="settings[view_mode]"]/option[@selected="selected"]', 'test_view_mode', 'View mode changed to Test View Mode');
+    $this->assertSession()->fieldValueEquals('settings[view_mode]', 'test_view_mode');
 
     // Check that the block exists in the database.
     $blocks = \Drupal::entityTypeManager()
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
index 695987ade436eb5f4ff4f186968e02119d259e5e..9ac4150c5be9ef6dfdf98db447bf3f62dbebc1e6 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
@@ -68,7 +68,7 @@ public function testListing() {
 
     // Confirm that once the user returns to the listing, the text of the label
     // (versus elsewhere on the page).
-    $this->assertFieldByXpath('//td', $label, 'Label found for added block.');
+    $this->assertSession()->elementTextContains('xpath', '//td', $label);
 
     // Check the number of table row cells.
     $elements = $this->xpath('//div[@class="layout-content"]//table/tbody/tr[@class="odd"]/td');
@@ -98,7 +98,7 @@ public function testListing() {
 
     // Confirm that once the user returns to the listing, the text of the label
     // (versus elsewhere on the page).
-    $this->assertFieldByXpath('//td', $new_label, 'Label found for updated custom block.');
+    $this->assertSession()->elementTextContains('xpath', '//td', $new_label);
 
     // Delete the added entity using the operations link.
     $this->assertSession()->linkByHrefExists('block/' . $block->id() . '/delete');
@@ -110,7 +110,7 @@ public function testListing() {
 
     // Verify that the text of the label and machine name does not appear in
     // the list (though it may appear elsewhere on the page).
-    $this->assertNoFieldByXpath('//td', $new_label, 'No label found for deleted custom block.');
+    $this->assertSession()->elementTextNotContains('xpath', '//td', $new_label);
 
     // Confirm that the empty text is displayed.
     $this->assertText(t('There are no custom blocks yet.'));
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
index 88e42a2170696d0c19f3d5841bf3816da68990c7..638ce2dec9f4621937542c6abc8e3575f207218f 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
@@ -80,7 +80,7 @@ public function testListing() {
 
     // Confirm that once the user returns to the listing, the text of the label
     // (versus elsewhere on the page).
-    $this->assertFieldByXpath('//td/a', $label, 'Label found for added block.');
+    $this->assertSession()->elementTextContains('xpath', '//td/a', $label);
 
     // Check the number of table row cells.
     $elements = $this->xpath('//div[@class="layout-content"]//table/tbody/tr/td');
@@ -110,7 +110,7 @@ public function testListing() {
 
     // Confirm that once the user returns to the listing, the text of the label
     // (versus elsewhere on the page).
-    $this->assertFieldByXpath('//td/a', $new_label, 'Label found for updated custom block.');
+    $this->assertSession()->elementTextContains('xpath', '//td/a', $new_label);
 
     // Delete the added entity using the operations link.
     $this->assertSession()->linkByHrefExists('block/' . $block->id() . '/delete');
@@ -122,7 +122,7 @@ public function testListing() {
 
     // Verify that the text of the label and machine name does not appear in
     // the list (though it may appear elsewhere on the page).
-    $this->assertNoFieldByXpath('//td', $new_label, 'No label found for deleted custom block.');
+    $this->assertSession()->elementTextNotContains('xpath', '//td', $new_label);
 
     // Confirm that the empty text is displayed.
     $this->assertText('There are no custom blocks available.');
diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php
index 4f357180475034bb6f0eb0782b7a7becd9f51228..4d4094692fc64d5a456ccb9808c63c9153aefe9f 100644
--- a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php
+++ b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php
@@ -140,7 +140,7 @@ public function testExistingFormat() {
 
     // Ensure the styles textarea exists and is initialized empty.
     $styles_textarea = $this->xpath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]');
-    $this->assertFieldByXPath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]', '', 'The styles textarea exists and is empty.');
+    $this->assertSession()->fieldValueEquals('editor[settings][plugins][stylescombo][styles]', '');
     $this->assertCount(1, $styles_textarea, 'The "styles" textarea exists.');
 
     // Submit the form to save the selection of CKEditor as the chosen editor.
@@ -284,7 +284,7 @@ public function testNewFormat() {
 
     // Ensure the styles textarea exists and is initialized empty.
     $styles_textarea = $this->xpath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]');
-    $this->assertFieldByXPath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]', '', 'The styles textarea exists and is empty.');
+    $this->assertSession()->fieldValueEquals('editor[settings][plugins][stylescombo][styles]', '');
     $this->assertCount(1, $styles_textarea, 'The "styles" textarea exists.');
 
     // Submit the form to create both a new text format and an associated text
diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
index ffdcd3d53fc9b739d09c72a3ea7808ed3c92861a..4f0f8d8c88245a6d7e3202d4f02b1329437bebd9 100644
--- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
@@ -76,7 +76,7 @@ public function testCommentPreview() {
     $this->assertSession()->fieldValueEquals('comment_body[0][value]', $edit['comment_body[0][value]']);
 
     // Check that the user picture is displayed.
-    $this->assertFieldByXPath("//article[contains(@class, 'preview')]//div[contains(@class, 'user-picture')]//img", NULL, 'User picture displayed.');
+    $this->assertSession()->elementExists('xpath', "//article[contains(@class, 'preview')]//div[contains(@class, 'user-picture')]//img");
   }
 
   /**
diff --git a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php
index 50217d38c130fcfafc46ae66ac9f725101356bb9..e4407d34cd625b6b01f903687bccbcd37eb0ba66 100644
--- a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\Tests\comment\Functional;
 
-use Drupal\Component\Render\FormattableMarkup;
 use Drupal\comment\CommentManagerInterface;
 
 /**
@@ -143,13 +142,7 @@ protected function assertParentLink($cid, $pid) {
     //  </article>
     $pattern = "//article[@id='comment-$cid']//p[contains(@class, 'parent')]//a[contains(@href, 'comment-$pid')]";
 
-    $this->assertFieldByXpath($pattern, NULL, new FormattableMarkup(
-      'Comment %cid has a link to parent %pid.',
-      [
-        '%cid' => $cid,
-        '%pid' => $pid,
-      ]
-    ));
+    $this->assertSession()->elementExists('xpath', $pattern);
   }
 
   /**
@@ -166,12 +159,7 @@ protected function assertNoParentLink($cid) {
     //  </article>
 
     $pattern = "//article[@id='comment-$cid']//p[contains(@class, 'parent')]";
-    $this->assertNoFieldByXpath($pattern, NULL, new FormattableMarkup(
-      'Comment %cid does not have a link to a parent.',
-      [
-        '%cid' => $cid,
-      ]
-    ));
+    $this->assertSession()->elementNotExists('xpath', $pattern);
   }
 
 }
diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
index 95358c8e6af0478db7d139140fadda20e3253249..ddba30c94a4b03beb57c549b11e913229e943fb1 100644
--- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
@@ -209,8 +209,8 @@ public function testListUI() {
     // Confirm that the user is returned to the listing, and verify that the
     // text of the label and machine name appears in the list (versus elsewhere
     // on the page).
-    $this->assertFieldByXpath('//td', 'Antelope', "Label found for added 'Antelope' entity.");
-    $this->assertFieldByXpath('//td', 'antelope', "Machine name found for added 'Antelope' entity.");
+    $this->assertSession()->elementExists('xpath', '//td[text() = "Antelope"]');
+    $this->assertSession()->elementExists('xpath', '//td[text() = "antelope"]');
 
     // Edit the entity using the operations link.
     $this->assertSession()->linkByHrefExists('admin/structure/config_test/manage/antelope');
@@ -223,8 +223,8 @@ public function testListUI() {
     // Confirm that the user is returned to the listing, and verify that the
     // text of the label and machine name appears in the list (versus elsewhere
     // on the page).
-    $this->assertFieldByXpath('//td', 'Albatross', "Label found for updated 'Albatross' entity.");
-    $this->assertFieldByXpath('//td', 'albatross', "Machine name found for updated 'Albatross' entity.");
+    $this->assertSession()->elementExists('xpath', '//td[text() = "Albatross"]');
+    $this->assertSession()->elementExists('xpath', '//td[text() = "albatross"]');
 
     // Delete the added entity using the operations link.
     $this->assertSession()->linkByHrefExists('admin/structure/config_test/manage/albatross/delete');
@@ -235,8 +235,8 @@ public function testListUI() {
 
     // Verify that the text of the label and machine name does not appear in
     // the list (though it may appear elsewhere on the page).
-    $this->assertNoFieldByXpath('//td', 'Albatross', "No label found for deleted 'Albatross' entity.");
-    $this->assertNoFieldByXpath('//td', 'albatross', "No machine name found for deleted 'Albatross' entity.");
+    $this->assertSession()->elementNotExists('xpath', '//td[text() = "Albatross"]');
+    $this->assertSession()->elementNotExists('xpath', '//td[text() = "albatross"]');
 
     // Delete the original entity using the operations link.
     $this->clickLink('Delete');
@@ -246,8 +246,8 @@ public function testListUI() {
 
     // Verify that the text of the label and machine name does not appear in
     // the list (though it may appear elsewhere on the page).
-    $this->assertNoFieldByXpath('//td', 'Default', "No label found for deleted 'Default' entity.");
-    $this->assertNoFieldByXpath('//td', 'dotted.default', "No machine name found for deleted 'Default' entity.");
+    $this->assertSession()->elementNotExists('xpath', '//td[text() = "Default"]');
+    $this->assertSession()->elementNotExists('xpath', '//td[text() = "dotted.default"]');
 
     // Confirm that the empty text is displayed.
     $this->assertText('There are no test configuration entities yet.');
diff --git a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
index 1f3ae8fe25f8f67e0bcc7578bd72eb803f832978..7ee8f2463ecc189d7ac8a7f775cfd3fdbbe5998e 100644
--- a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
@@ -243,8 +243,11 @@ public function testImportSimpleConfiguration() {
   public function testExport() {
     $this->drupalLogin($this->drupalCreateUser(['export configuration']));
 
+    // Verify that the simple configuration option is selected when specified
+    // in the URL.
     $this->drupalGet('admin/config/development/configuration/single/export/system.simple');
-    $this->assertFieldByXPath('//select[@name="config_type"]//option[@selected="selected"]', t('Simple configuration'), 'The simple configuration option is selected when specified in the URL.');
+    $option_node = $this->assertSession()->optionExists("config_type", 'Simple configuration');
+    $this->assertTrue($option_node->isSelected());
     // Spot check several known simple configuration files.
     $element = $this->xpath('//select[@name="config_name"]')[0];
     $options = $element->findAll('css', 'option');
@@ -257,12 +260,17 @@ public function testExport() {
     $this->drupalGet('admin/config/development/configuration/single/export/system.simple/system.image');
     $this->assertEquals("toolkit: gd\n_core:\n  default_config_hash: durWHaKeBaq4d9Wpi4RqwADj1OufDepcnJuhVLmKN24\n", $this->xpath('//textarea[@name="export"]')[0]->getValue(), 'The expected system configuration is displayed.');
 
+    // Verify that the date format entity type is selected when specified in
+    // the URL.
     $this->drupalGet('admin/config/development/configuration/single/export/date_format');
-    $this->assertFieldByXPath('//select[@name="config_type"]//option[@selected="selected"]', t('Date format'), 'The date format entity type is selected when specified in the URL.');
+    $option_node = $this->assertSession()->optionExists("config_type", 'Date format');
+    $this->assertTrue($option_node->isSelected());
 
+    // Verify that the fallback date format config entity is selected when
+    // specified in the URL.
     $this->drupalGet('admin/config/development/configuration/single/export/date_format/fallback');
-    $this->assertFieldByXPath('//select[@name="config_name"]//option[@selected="selected"]', t('Fallback date format (fallback)'), 'The fallback date format config entity is selected when specified in the URL.');
-
+    $option_node = $this->assertSession()->optionExists("config_name", 'Fallback date format (fallback)');
+    $this->assertTrue($option_node->isSelected());
     $fallback_date = \Drupal::entityTypeManager()->getStorage('date_format')->load('fallback');
     $yaml_text = $this->xpath('//textarea[@name="export"]')[0]->getValue();
     $this->assertEquals(Yaml::decode($yaml_text), $fallback_date->toArray(), 'The fallback date format config entity export code is displayed.');
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
index 65f9be8fab635f6df2679bfd718746c1d7a350ba..2bfba1d82feada3231393fb53c3df845a669cc84 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
@@ -535,8 +535,7 @@ public function testAccountSettingsConfigurationTranslation() {
     $this->drupalGet('admin/config/people/accounts/translate/fr/edit');
     foreach ($edit as $key => $value) {
       // Check the translations appear in the right field type as well.
-      $xpath = '//' . (strpos($key, '[body]') ? 'textarea' : 'input') . '[@name="' . $key . '"]';
-      $this->assertFieldByXPath($xpath, $value);
+      $this->assertSession()->fieldValueEquals($key, $value);
     }
     // Check that labels for email settings appear.
     $this->assertText(t('Account cancellation confirmation'));
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
index b1a52a82e83242eca341b9a9aa0de25b5b801ac3..b07f7062f664337eddb667200543e93aab7656f8 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
@@ -284,7 +284,7 @@ public function testFieldTranslatableSettingsUI() {
     // translatable.
     $path = 'admin/structure/types/manage/article/fields/node.article.field_article_text';
     $this->drupalGet($path);
-    $this->assertFieldByXPath('//input[@id="edit-translatable" and @disabled="disabled"]');
+    $this->assertSession()->fieldDisabled('edit-translatable');
     $this->assertText('To configure translation for this field, enable language support for this type.', 'No translatable setting for field.');
 
     // Tests that field has translatable setting if bundle is translatable.
@@ -297,7 +297,8 @@ public function testFieldTranslatableSettingsUI() {
     ];
     $this->assertSettings('node', 'article', TRUE, $edit);
     $this->drupalGet($path);
-    $this->assertFieldByXPath('//input[@id="edit-translatable" and not(@disabled) and @checked="checked"]');
+    $this->assertSession()->fieldEnabled('edit-translatable');
+    $this->assertSession()->checkboxChecked('edit-translatable');
     $this->assertNoText('To enable translation of this field, enable language support for this type.', 'Translatable setting for field available.');
   }
 
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationStandardFieldsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationStandardFieldsTest.php
index 727d59701465e22706beadf660853ee11acea31c..489fc9d0bea5cc04270b645853939635dfd9f8b2 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationStandardFieldsTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationStandardFieldsTest.php
@@ -58,18 +58,18 @@ public function testFieldTranslatableArticle() {
     $this->drupalGet($path);
 
     // Check content block fields.
-    $this->assertFieldByXPath("//input[@id='edit-settings-block-content-basic-fields-body' and @checked='checked']");
+    $this->assertSession()->checkboxChecked('edit-settings-block-content-basic-fields-body');
 
     // Check comment fields.
-    $this->assertFieldByXPath("//input[@id='edit-settings-comment-comment-fields-comment-body' and @checked='checked']");
+    $this->assertSession()->checkboxChecked('edit-settings-comment-comment-fields-comment-body');
 
     // Check node fields.
-    $this->assertFieldByXPath("//input[@id='edit-settings-node-article-fields-comment' and @checked='checked']");
-    $this->assertFieldByXPath("//input[@id='edit-settings-node-article-fields-field-image' and @checked='checked']");
-    $this->assertFieldByXPath("//input[@id='edit-settings-node-article-fields-field-tags' and @checked='checked']");
+    $this->assertSession()->checkboxChecked('edit-settings-node-article-fields-comment');
+    $this->assertSession()->checkboxChecked('edit-settings-node-article-fields-field-image');
+    $this->assertSession()->checkboxChecked('edit-settings-node-article-fields-field-tags');
 
     // Check user fields.
-    $this->assertFieldByXPath("//input[@id='edit-settings-user-user-fields-user-picture' and @checked='checked']");
+    $this->assertSession()->checkboxChecked('edit-settings-user-user-fields-user-picture');
   }
 
   /**
@@ -78,7 +78,7 @@ public function testFieldTranslatableArticle() {
   public function testRevisionLogNotTranslatable() {
     $path = 'admin/config/regional/content-language';
     $this->drupalGet($path);
-    $this->assertNoFieldByXPath("//input[@id='edit-settings-node-article-fields-revision-log']");
+    $this->assertSession()->fieldNotExists('edit-settings-node-article-fields-revision-log');
   }
 
 }
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
index 162c5d1f81634411d5e388a9672ade3cc243d0d7..f9ae86f2a34117b22352c67f7fd1cf471f59e21b 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
@@ -157,7 +157,8 @@ protected function doTestBasicTranslation() {
     }
 
     if ($this->testLanguageSelector) {
-      $this->assertNoFieldByXPath('//select[@id="edit-langcode-0-value"]', NULL, 'Language selector correctly disabled on translations.');
+      // Verify that language selector is correctly disabled on translations.
+      $this->assertSession()->fieldNotExists('edit-langcode-0-value');
     }
     $storage->resetCache([$this->entityId]);
     $entity = $storage->load($this->entityId);
@@ -178,7 +179,7 @@ protected function doTestBasicTranslation() {
     // This does not save anything, it merely reloads the form and fills in the
     // fields with the values from the different source language.
     $this->drupalPostForm($add_url, $edit, t('Change'));
-    $this->assertFieldByXPath("//input[@name=\"{$this->fieldName}[0][value]\"]", $values[$source_langcode][$this->fieldName][0]['value'], 'Source language correctly switched.');
+    $this->assertSession()->fieldValueEquals("{$this->fieldName}[0][value]", $values[$source_langcode][$this->fieldName][0]['value']);
 
     // Add another translation and mark the other ones as outdated.
     $values[$langcode] = $this->getNewEntityValues($langcode);
@@ -256,16 +257,19 @@ protected function doTestOutdatedStatus() {
       $url = $entity->toUrl('edit-form', ['language' => ConfigurableLanguage::load($added_langcode)]);
       $this->drupalGet($url);
       if ($added_langcode == $langcode) {
-        $this->assertFieldByXPath('//input[@name="content_translation[retranslate]"]', FALSE, 'The retranslate flag is not checked by default.');
+        // Verify that the retranslate flag is not checked by default.
+        $this->assertSession()->fieldValueEquals('content_translation[retranslate]', FALSE);
         $this->assertEmpty($this->xpath('//details[@id="edit-content-translation" and @open="open"]'), 'The translation tab should be collapsed by default.');
       }
       else {
-        $this->assertFieldByXPath('//input[@name="content_translation[outdated]"]', TRUE, 'The translate flag is checked by default.');
+        // Verify that the translate flag is checked by default.
+        $this->assertSession()->fieldValueEquals('content_translation[outdated]', TRUE);
         $this->assertNotEmpty($this->xpath('//details[@id="edit-content-translation" and @open="open"]'), 'The translation tab is correctly expanded when the translation is outdated.');
         $edit = ['content_translation[outdated]' => FALSE];
         $this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $added_langcode));
         $this->drupalGet($url);
-        $this->assertFieldByXPath('//input[@name="content_translation[retranslate]"]', FALSE, 'The retranslate flag is now shown.');
+        // Verify that retranslate flag is now shown.
+        $this->assertSession()->fieldValueEquals('content_translation[retranslate]', FALSE);
         $storage = $this->container->get('entity_type.manager')
           ->getStorage($this->entityTypeId);
         $storage->resetCache([$this->entityId]);
@@ -300,7 +304,8 @@ protected function doTestPublishedStatus() {
 
     // Check that the last published translation cannot be unpublished.
     $this->drupalGet($entity->toUrl('edit-form'));
-    $this->assertFieldByXPath('//input[@name="content_translation[status]" and @disabled="disabled"]', TRUE, 'The last translation is published and cannot be unpublished.');
+    $this->assertSession()->fieldDisabled('content_translation[status]');
+    $this->assertSession()->fieldValueEquals('content_translation[status]', TRUE);
   }
 
   /**
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
index c214765b435ef707c79d6346a4eeff5bde1ef0bb..9183e69dd6665e76b70ab0aad2eda2c0d1a4bd35 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
@@ -416,7 +416,7 @@ protected function doTestWorkflows(UserInterface $user, $expected_status) {
    */
   protected function assertNoSharedElements() {
     $language_none = LanguageInterface::LANGCODE_NOT_SPECIFIED;
-    return $this->assertNoFieldByXPath("//input[@name='field_test_text[$language_none][0][value]']", NULL, 'Shared elements are not available on the translation form.');
+    return $this->assertSession()->fieldNotExists("field_test_text[$language_none][0][value]");
   }
 
 }
diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
index 4ca06b545720ea9c711510ffd72916cf2b600741..ba0b2d315b15798f8a636dd5110230763e5575fe 100644
--- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
@@ -55,10 +55,11 @@ public function testDateField() {
       // Display creation form.
       $this->drupalGet('entity_test/add');
       $this->assertSession()->fieldValueEquals("{$field_name}[0][value][date]", '');
-      $this->assertFieldByXPath('//*[@id="edit-' . $field_name . '-wrapper"]//label[contains(@class,"js-form-required")]', TRUE, 'Required markup found');
+      $this->assertSession()->elementExists('xpath', '//*[@id="edit-' . $field_name . '-wrapper"]//label[contains(@class,"js-form-required")]');
       $this->assertSession()->fieldNotExists("{$field_name}[0][value][time]");
-      $this->assertFieldByXPath('//input[@aria-describedby="edit-' . $field_name . '-0-value--description"]', NULL, 'ARIA described-by found');
-      $this->assertFieldByXPath('//div[@id="edit-' . $field_name . '-0-value--description"]', NULL, 'ARIA description found');
+      // ARIA described-by.
+      $this->assertSession()->elementExists('xpath', '//input[@aria-describedby="edit-' . $field_name . '-0-value--description"]');
+      $this->assertSession()->elementExists('xpath', '//div[@id="edit-' . $field_name . '-0-value--description"]');
 
       // Build up a date in the UTC timezone. Note that using this will also
       // mimic the user in a different timezone simply entering '2012-12-31' via
@@ -249,9 +250,9 @@ public function testDatetimeField() {
     $this->drupalGet('entity_test/add');
     $this->assertSession()->fieldValueEquals("{$field_name}[0][value][date]", '');
     $this->assertSession()->fieldValueEquals("{$field_name}[0][value][time]", '');
-    $this->assertFieldByXPath('//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label, 'Fieldset and label found');
-    $this->assertFieldByXPath('//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]', NULL, 'ARIA described-by found');
-    $this->assertFieldByXPath('//div[@id="edit-' . $field_name . '-0--description"]', NULL, 'ARIA description found');
+    $this->assertSession()->elementTextContains('xpath', '//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label);
+    $this->assertSession()->elementExists('xpath', '//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]');
+    $this->assertSession()->elementExists('xpath', '//div[@id="edit-' . $field_name . '-0--description"]');
 
     // Build up a date in the UTC timezone.
     $value = '2012-12-31 00:00:00';
@@ -413,13 +414,13 @@ public function testDatelistWidget() {
 
     // Display creation form.
     $this->drupalGet('entity_test/add');
-    $this->assertFieldByXPath('//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label, 'Fieldset and label found');
-    $this->assertFieldByXPath('//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]', NULL, 'ARIA described-by found');
-    $this->assertFieldByXPath('//div[@id="edit-' . $field_name . '-0--description"]', NULL, 'ARIA description found');
+    $this->assertSession()->elementTextContains('xpath', '//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label);
+    $this->assertSession()->elementExists('xpath', '//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]');
+    $this->assertSession()->elementExists('xpath', '//div[@id="edit-' . $field_name . '-0--description"]');
 
     // Assert that Hour and Minute Elements do not appear on Date Only
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-hour\"]", NULL, 'Hour element not found on Date Only.');
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-minute\"]", NULL, 'Minute element not found on Date Only.');
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-hour\"]");
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-minute\"]");
 
     // Go to the form display page to assert that increment option does not appear on Date Only
     $fieldEditUrl = 'entity_test/structure/entity_test/form-display';
@@ -428,7 +429,7 @@ public function testDatelistWidget() {
     // Click on the widget settings button to open the widget settings form.
     $this->drupalPostForm(NULL, [], $field_name . "_settings_edit");
     $xpathIncr = "//select[starts-with(@id, \"edit-fields-$field_name-settings-edit-form-settings-increment\")]";
-    $this->assertNoFieldByXPath($xpathIncr, NULL, 'Increment element not found for Date Only.');
+    $this->assertSession()->elementNotExists('xpath', $xpathIncr);
 
     // Change the field to a datetime field.
     $this->fieldStorage->setSetting('datetime_type', 'datetime');
@@ -453,28 +454,35 @@ public function testDatelistWidget() {
 
     // Click on the widget settings button to open the widget settings form.
     $this->drupalPostForm(NULL, [], $field_name . "_settings_edit");
-    $this->assertFieldByXPath($xpathIncr, NULL, 'Increment element found for Date and time.');
+    $this->assertSession()->elementExists('xpath', $xpathIncr);
 
     // Display creation form.
     $this->drupalGet('entity_test/add');
 
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-year\"]", NULL, 'Year element found.');
+    // Year element.
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-value-year\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '')->isSelected());
     $this->assertSession()->optionExists("edit-$field_name-0-value-year", 'Year');
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-month\"]", NULL, 'Month element found.');
+    // Month element.
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-value-month\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '')->isSelected());
     $this->assertSession()->optionExists("edit-$field_name-0-value-month", 'Month');
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-day\"]", NULL, 'Day element found.');
+    // Day element.
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-value-day\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-day", '')->isSelected());
     $this->assertSession()->optionExists("edit-$field_name-0-value-day", 'Day');
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-hour\"]", NULL, 'Hour element found.');
+    // Hour element.
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-value-hour\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-hour", '')->isSelected());
     $this->assertSession()->optionExists("edit-$field_name-0-value-hour", 'Hour');
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-minute\"]", NULL, 'Minute element found.');
+    // Minute element.
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-value-minute\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-minute", '')->isSelected());
     $this->assertSession()->optionExists("edit-$field_name-0-value-minute", 'Minute');
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-second\"]", NULL, 'Second element not found.');
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-ampm\"]", NULL, 'AMPM element found.');
+    // No Second element.
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-second\"]");
+    // AMPM element.
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-value-ampm\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-ampm", '')->isSelected());
     $this->assertSession()->optionExists("edit-$field_name-0-value-ampm", 'AM/PM');
 
@@ -517,9 +525,9 @@ public function testDatelistWidget() {
     $this->drupalGet('entity_test/add');
 
     // Other elements are unaffected by the changed settings.
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-hour\"]", NULL, 'Hour element found.');
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-value-hour\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-hour", '')->isSelected());
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-ampm\"]", NULL, 'AMPM element not found.');
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-ampm\"]");
     // Submit a valid date and ensure it is accepted.
     $date_value = ['year' => 2012, 'month' => 12, 'day' => 31, 'hour' => 17, 'minute' => 15];
 
diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
index c4fc4af12b79f19161afb3a5cc81f0acf39f0851..4d9fde69d8fe89906e27efa321aa94d71829ebf2 100644
--- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
+++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
@@ -68,12 +68,12 @@ public function testDateRangeField() {
       $this->drupalGet('entity_test/add');
       $this->assertSession()->fieldValueEquals("{$field_name}[0][value][date]", '');
       $this->assertSession()->fieldValueEquals("{$field_name}[0][end_value][date]", '');
-      $this->assertFieldByXPath('//*[@id="edit-' . $field_name . '-wrapper"]//label[contains(@class, "js-form-required")]', TRUE, 'Required markup found');
+      $this->assertSession()->elementExists('xpath', '//*[@id="edit-' . $field_name . '-wrapper"]//label[contains(@class, "js-form-required")]');
       $this->assertSession()->fieldNotExists("{$field_name}[0][value][time]");
       $this->assertSession()->fieldNotExists("{$field_name}[0][end_value][time]");
-      $this->assertFieldByXPath('//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label, 'Fieldset and label found');
-      $this->assertFieldByXPath('//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]', NULL, 'ARIA described-by found');
-      $this->assertFieldByXPath('//div[@id="edit-' . $field_name . '-0--description"]', NULL, 'ARIA description found');
+      $this->assertSession()->elementTextContains('xpath', '//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label);
+      $this->assertSession()->elementExists('xpath', '//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]');
+      $this->assertSession()->elementExists('xpath', '//div[@id="edit-' . $field_name . '-0--description"]');
 
       // Build up dates in the UTC timezone.
       $value = '2012-12-31 00:00:00';
@@ -160,7 +160,7 @@ public function testDateRangeField() {
       // Verify that hook_entity_prepare_view can add attributes.
       // @see entity_test_entity_prepare_view()
       $this->drupalGet('entity_test/' . $id);
-      $this->assertFieldByXPath('//div[@data-field-item-attr="foobar"]');
+      $this->assertSession()->elementExists('xpath', '//div[@data-field-item-attr="foobar"]');
 
       // Verify that the plain formatter works.
       $this->displayOptions['type'] = 'daterange_plain';
@@ -250,7 +250,7 @@ public function testDateRangeField() {
       // Verify that hook_entity_prepare_view can add attributes.
       // @see entity_test_entity_prepare_view()
       $this->drupalGet('entity_test/' . $id);
-      $this->assertFieldByXPath('//time[@data-field-item-attr="foobar"]');
+      $this->assertSession()->elementExists('xpath', '//time[@data-field-item-attr="foobar"]');
 
       $this->displayOptions['type'] = 'daterange_plain';
       $this->displayOptions['settings'] = $this->defaultSettings;
@@ -298,9 +298,9 @@ public function testDatetimeRangeField() {
     $this->assertSession()->fieldValueEquals("{$field_name}[0][value][time]", '');
     $this->assertSession()->fieldValueEquals("{$field_name}[0][end_value][date]", '');
     $this->assertSession()->fieldValueEquals("{$field_name}[0][end_value][time]", '');
-    $this->assertFieldByXPath('//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label, 'Fieldset and label found');
-    $this->assertFieldByXPath('//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]', NULL, 'ARIA described-by found');
-    $this->assertFieldByXPath('//div[@id="edit-' . $field_name . '-0--description"]', NULL, 'ARIA description found');
+    $this->assertSession()->elementTextContains('xpath', '//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label);
+    $this->assertSession()->elementExists('xpath', '//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]');
+    $this->assertSession()->elementExists('xpath', '//div[@id="edit-' . $field_name . '-0--description"]');
 
     // Build up dates in the UTC timezone.
     $value = '2012-12-31 00:00:00';
@@ -357,7 +357,7 @@ public function testDatetimeRangeField() {
     // Verify that hook_entity_prepare_view can add attributes.
     // @see entity_test_entity_prepare_view()
     $this->drupalGet('entity_test/' . $id);
-    $this->assertFieldByXPath('//div[@data-field-item-attr="foobar"]');
+    $this->assertSession()->elementExists('xpath', '//div[@data-field-item-attr="foobar"]');
 
     // Verify that the plain formatter works.
     $this->displayOptions['type'] = 'daterange_plain';
@@ -435,7 +435,7 @@ public function testDatetimeRangeField() {
     // Verify that hook_entity_prepare_view can add attributes.
     // @see entity_test_entity_prepare_view()
     $this->drupalGet('entity_test/' . $id);
-    $this->assertFieldByXPath('//time[@data-field-item-attr="foobar"]');
+    $this->assertSession()->elementExists('xpath', '//time[@data-field-item-attr="foobar"]');
 
     $this->displayOptions['type'] = 'daterange_plain';
     $this->displayOptions['settings'] = $this->defaultSettings;
@@ -474,12 +474,12 @@ public function testAlldayRangeField() {
     $this->drupalGet('entity_test/add');
     $this->assertSession()->fieldValueEquals("{$field_name}[0][value][date]", '');
     $this->assertSession()->fieldValueEquals("{$field_name}[0][end_value][date]", '');
-    $this->assertFieldByXPath('//*[@id="edit-' . $field_name . '-wrapper"]//label[contains(@class, "js-form-required")]', TRUE, 'Required markup found');
+    $this->assertSession()->elementExists('xpath', '//*[@id="edit-' . $field_name . '-wrapper"]//label[contains(@class, "js-form-required")]');
     $this->assertSession()->fieldNotExists("{$field_name}[0][value][time]");
     $this->assertSession()->fieldNotExists("{$field_name}[0][end_value][time]");
-    $this->assertFieldByXPath('//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label, 'Fieldset and label found');
-    $this->assertFieldByXPath('//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]', NULL, 'ARIA described-by found');
-    $this->assertFieldByXPath('//div[@id="edit-' . $field_name . '-0--description"]', NULL, 'ARIA description found');
+    $this->assertSession()->elementTextContains('xpath', '//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label);
+    $this->assertSession()->elementExists('xpath', '//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]');
+    $this->assertSession()->elementExists('xpath', '//div[@id="edit-' . $field_name . '-0--description"]');
 
     // Build up dates in the proper timezone.
     $value = '2012-12-31 00:00:00';
@@ -530,7 +530,7 @@ public function testAlldayRangeField() {
     // Verify that hook_entity_prepare_view can add attributes.
     // @see entity_test_entity_prepare_view()
     $this->drupalGet('entity_test/' . $id);
-    $this->assertFieldByXPath('//div[@data-field-item-attr="foobar"]');
+    $this->assertSession()->elementExists('xpath', '//div[@data-field-item-attr="foobar"]');
 
     // Verify that the plain formatter works.
     $this->displayOptions['type'] = 'daterange_plain';
@@ -611,7 +611,7 @@ public function testAlldayRangeField() {
     // Verify that hook_entity_prepare_view can add attributes.
     // @see entity_test_entity_prepare_view()
     $this->drupalGet('entity_test/' . $id);
-    $this->assertFieldByXPath('//div[@data-field-item-attr="foobar"]');
+    $this->assertSession()->elementExists('xpath', '//div[@data-field-item-attr="foobar"]');
 
     $this->displayOptions['type'] = 'daterange_plain';
     $this->container->get('entity_display.repository')
@@ -662,15 +662,15 @@ public function testDatelistWidget() {
 
     // Display creation form.
     $this->drupalGet('entity_test/add');
-    $this->assertFieldByXPath('//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label, 'Fieldset and label found');
-    $this->assertFieldByXPath('//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]', NULL, 'ARIA described-by found');
-    $this->assertFieldByXPath('//div[@id="edit-' . $field_name . '-0--description"]', NULL, 'ARIA description found');
+    $this->assertSession()->elementTextContains('xpath', '//fieldset[@id="edit-' . $field_name . '-0"]/legend', $field_label);
+    $this->assertSession()->elementExists('xpath', '//fieldset[@aria-describedby="edit-' . $field_name . '-0--description"]');
+    $this->assertSession()->elementExists('xpath', '//div[@id="edit-' . $field_name . '-0--description"]');
 
     // Assert that Hour and Minute Elements do not appear on Date Only.
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-hour\"]", NULL, 'Hour element not found on Date Only.');
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-minute\"]", NULL, 'Minute element not found on Date Only.');
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-end-value-hour\"]", NULL, 'Hour element not found on Date Only.');
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-end-value-minute\"]", NULL, 'Minute element not found on Date Only.');
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-hour\"]");
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-minute\"]");
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-end-value-hour\"]");
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-end-value-minute\"]");
 
     // Go to the form display page to assert that increment option does not
     // appear on Date Only.
@@ -680,7 +680,7 @@ public function testDatelistWidget() {
     // Click on the widget settings button to open the widget settings form.
     $this->drupalPostForm(NULL, [], $field_name . "_settings_edit");
     $xpathIncr = "//select[starts-with(@id, \"edit-fields-$field_name-settings-edit-form-settings-increment\")]";
-    $this->assertNoFieldByXPath($xpathIncr, NULL, 'Increment element not found for Date Only.');
+    $this->assertSession()->elementNotExists('xpath', $xpathIncr);
 
     // Change the field is set to an all day field.
     $this->fieldStorage->setSetting('datetime_type', DateRangeItem::DATETIME_TYPE_ALLDAY);
@@ -701,10 +701,10 @@ public function testDatelistWidget() {
     $this->drupalGet('entity_test/add');
 
     // Assert that Hour and Minute Elements do not appear on Date Only.
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-hour\"]", NULL, 'Hour element not found on Date Only.');
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-minute\"]", NULL, 'Minute element not found on Date Only.');
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-end-value-hour\"]", NULL, 'Hour element not found on Date Only.');
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-end-value-minute\"]", NULL, 'Minute element not found on Date Only.');
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-hour\"]");
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-minute\"]");
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-end-value-hour\"]");
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-end-value-minute\"]");
 
     // Go to the form display page to assert that increment option does not
     // appear on Date Only.
@@ -714,7 +714,7 @@ public function testDatelistWidget() {
     // Click on the widget settings button to open the widget settings form.
     $this->drupalPostForm(NULL, [], $field_name . "_settings_edit");
     $xpathIncr = "//select[starts-with(@id, \"edit-fields-$field_name-settings-edit-form-settings-increment\")]";
-    $this->assertNoFieldByXPath($xpathIncr, NULL, 'Increment element not found for Date Only.');
+    $this->assertSession()->elementNotExists('xpath', $xpathIncr);
 
     // Change the field to a datetime field.
     $this->fieldStorage->setSetting('datetime_type', DateRangeItem::DATETIME_TYPE_DATETIME);
@@ -740,14 +740,14 @@ public function testDatelistWidget() {
 
     // Click on the widget settings button to open the widget settings form.
     $this->drupalPostForm(NULL, [], $field_name . "_settings_edit");
-    $this->assertFieldByXPath($xpathIncr, NULL, 'Increment element found for Date and time.');
+    $this->assertSession()->elementExists('xpath', $xpathIncr);
 
     // Display creation form.
     $this->drupalGet('entity_test/add');
 
     foreach (['value', 'end-value'] as $column) {
       foreach (['year', 'month', 'day', 'hour', 'minute', 'ampm'] as $element) {
-        $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-$column-$element\"]", NULL, $element . ' element found.');
+        $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-$column-$element\"]");
         $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-$column-$element", '')->isSelected());
       }
     }
@@ -803,12 +803,12 @@ public function testDatelistWidget() {
     $this->drupalGet('entity_test/add');
 
     // Other elements are unaffected by the changed settings.
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-hour\"]", NULL, 'Hour element found.');
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-value-hour\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-hour", '')->isSelected());
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-ampm\"]", NULL, 'AMPM element not found.');
-    $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-end-value-hour\"]", NULL, 'Hour element found.');
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-ampm\"]");
+    $this->assertSession()->elementExists('xpath', "//*[@id=\"edit-$field_name-0-end-value-hour\"]");
     $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-end-value-hour", '')->isSelected());
-    $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-end-value-ampm\"]", NULL, 'AMPM element not found.');
+    $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-end-value-ampm\"]");
 
     // Submit a valid date and ensure it is accepted.
     $start_date_value = ['year' => 2012, 'month' => 12, 'day' => 31, 'hour' => 17, 'minute' => 15];
diff --git a/core/modules/editor/tests/src/Functional/EditorLoadingTest.php b/core/modules/editor/tests/src/Functional/EditorLoadingTest.php
index 5455251d5e41765248c12db8c0512b3b033621cf..1cdf63b074dde4a38875370fd0d188ca7697614a 100644
--- a/core/modules/editor/tests/src/Functional/EditorLoadingTest.php
+++ b/core/modules/editor/tests/src/Functional/EditorLoadingTest.php
@@ -234,7 +234,8 @@ public function testLoading() {
     $this->assertTrue($editor_settings_present, 'Text Editor module settings.');
     $this->assertTrue($editor_js_present, 'Text Editor JavaScript.');
     $this->assertCount(1, $body, 'A body field exists.');
-    $this->assertFieldByXPath('//textarea[@id="edit-body-0-value" and @disabled="disabled"]', t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
+    $this->assertSession()->fieldDisabled("edit-body-0-value");
+    $this->assertSession()->fieldValueEquals("edit-body-0-value", 'This field has been disabled because you do not have sufficient permissions to edit it.');
     $this->assertCount(0, $format_selector, 'No text format selector exists on the page.');
     $hidden_input = $this->xpath('//input[@type="hidden" and contains(@class, "editor")]');
     $this->assertCount(0, $hidden_input, 'A single text format hidden input does not exist on the page.');
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
index 1ab2db16b7124b238f0534322c6600b0e00a4b38..eb1a85be2b6379c20077a2cbcec42b6ab7e13d4f 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
@@ -323,8 +323,8 @@ public function testMultipleTargetBundles() {
     $this->drupalPostForm($path, $edit, 'Save settings');
     $this->drupalGet($path);
     // Expect a select element with the two vocabularies as options.
-    $this->assertFieldByXPath("//select[@name='settings[handler_settings][auto_create_bundle]']/option[@value='" . $vocabularies[0]->id() . "']");
-    $this->assertFieldByXPath("//select[@name='settings[handler_settings][auto_create_bundle]']/option[@value='" . $vocabularies[1]->id() . "']");
+    $this->assertSession()->optionExists('settings[handler_settings][auto_create_bundle]', $vocabularies[0]->id());
+    $this->assertSession()->optionExists('settings[handler_settings][auto_create_bundle]', $vocabularies[1]->id());
 
     $edit = [
       'settings[handler_settings][auto_create]' => TRUE,
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php
index 6f2754ad445888172b93593ce490ee47c81c046c..92e2c1c1e7e655d2db67c2c4f5be7102f29cafaa 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php
@@ -105,7 +105,8 @@ protected function setUp(): void {
    */
   public function testAutoCreate() {
     $this->drupalGet('node/add/' . $this->referencingType);
-    $this->assertFieldByXPath('//input[@id="edit-test-field-0-target-id" and contains(@class, "form-autocomplete")]', NULL, 'The autocomplete input element appears.');
+    $target = $this->assertSession()->fieldExists("edit-test-field-0-target-id");
+    $this->assertTrue($target->hasClass("form-autocomplete"));
 
     $new_title = $this->randomMachineName();
 
diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php
index 133eff05fb5ea5b18f639b1a88b777243bac8536..b943148395e3b21e6068dc4c339db492206072ee 100644
--- a/core/modules/field/tests/src/Functional/FormTest.php
+++ b/core/modules/field/tests/src/Functional/FormTest.php
@@ -202,7 +202,7 @@ public function testFieldFormDefaultValue() {
     // Display creation form.
     $this->drupalGet('entity_test/add');
     // Test that the default value is displayed correctly.
-    $this->assertFieldByXpath("//input[@name='{$field_name}[0][value]' and @value='$default']");
+    $this->assertSession()->fieldValueEquals("{$field_name}[0][value]", $default);
 
     // Try to submit an empty value.
     $edit = [
@@ -413,7 +413,7 @@ public function testFieldFormMultivalueWithRequiredRadio() {
     $this->drupalPostForm(NULL, [], t('Add another item'));
 
     // Verify that no error is thrown by the radio element.
-    $this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed.');
+    $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "error")]');
 
     // Verify that the widget is added.
     $this->assertSession()->fieldValueEquals("{$field_name}[0][value]", '');
diff --git a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php
index 9cbe7c00f69c28383d97139ed2f784a25560a1d7..6073273ed09dffe412eb628e01f3b48369d157b6 100644
--- a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php
+++ b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php
@@ -252,7 +252,9 @@ public function testNumberIntegerField() {
       $id = $match[1];
       $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
       $this->assertRaw($valid_entry);
-      $this->assertNoFieldByXpath('//div[@content="' . $valid_entry . '"]', NULL, 'The "content" attribute is not present since the Prefix is not being displayed');
+      // Verify that the "content" attribute is not present since the Prefix is
+      // not being displayed.
+      $this->assertSession()->elementNotExists('xpath', '//div[@content="' . $valid_entry . '"]');
     }
 
     // Test for the content attribute when a Prefix is displayed. Presumably this also tests for the attribute when a Suffix is displayed.
@@ -274,7 +276,9 @@ public function testNumberIntegerField() {
     $id = $match[1];
     $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
     $this->drupalGet('entity_test/' . $id);
-    $this->assertFieldByXPath('//div[@content="' . $integer_value . '"]', 'ThePrefix' . $integer_value, 'The "content" attribute has been set to the value of the field, and the prefix is being displayed.');
+    // Verify that the "content" attribute has been set to the value of the
+    // field, and the prefix is being displayed.
+    $this->assertSession()->elementTextContains('xpath', '//div[@content="' . $integer_value . '"]', 'ThePrefix' . $integer_value);
   }
 
   /**
diff --git a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
index 497cf4f6f18ed51bebeb33703149e3abae4e8b47..503f2f5c75351ec62fb7010cf328273b472f3b8e 100644
--- a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
+++ b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
@@ -145,11 +145,11 @@ public function testFieldAdminHandler() {
     $this->assertTrue($sorted, 'The "sort by" options are sorted.');
 
     // Test that a non-translatable base field is a sort option.
-    $this->assertFieldByXPath("//select[@name='settings[handler_settings][sort][field]']/option[@value='nid']");
+    $this->assertSession()->optionExists('settings[handler_settings][sort][field]', 'nid');
     // Test that a translatable base field is a sort option.
-    $this->assertFieldByXPath("//select[@name='settings[handler_settings][sort][field]']/option[@value='title']");
+    $this->assertSession()->optionExists('settings[handler_settings][sort][field]', 'title');
     // Test that a configurable field is a sort option.
-    $this->assertFieldByXPath("//select[@name='settings[handler_settings][sort][field]']/option[@value='body.value']");
+    $this->assertSession()->optionExists('settings[handler_settings][sort][field]', 'body.value');
 
     // Set back to no sort.
     $sort_by->setValue('_none');
@@ -162,7 +162,7 @@ public function testFieldAdminHandler() {
     ], t('Save settings'));
 
     // Check that the field appears in the overview form.
-    $this->assertFieldByXPath('//table[@id="field-overview"]//tr[@id="field-test"]/td[1]', 'Test', 'Field was created and appears in the overview page.');
+    $this->assertSession()->elementTextContains('xpath', '//table[@id="field-overview"]//tr[@id="field-test"]/td[1]', "Test");
 
     // Check that the field settings form can be submitted again, even when the
     // field is required.
diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
index 4f8eeafef2a725e053c20775a43858546db322eb..55f6fa94744ee9a7c23c7a2c4f18fc998148f553 100644
--- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
+++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
@@ -287,8 +287,8 @@ public function cardinalitySettings() {
     $this->drupalPostForm($field_edit_path, $edit, t('Save field settings'));
     $this->assertText('Updated field Body field settings.');
     $this->drupalGet($field_edit_path);
-    $this->assertFieldByXPath("//select[@name='cardinality']", 'number');
-    $this->assertFieldByXPath("//input[@name='cardinality_number']", 6);
+    $this->assertSession()->fieldValueEquals('cardinality', 'number');
+    $this->assertSession()->fieldValueEquals('cardinality_number', 6);
 
     // Check that tabs displayed.
     $this->assertSession()->linkExists('Edit');
@@ -320,8 +320,8 @@ public function cardinalitySettings() {
     $this->drupalPostForm($field_edit_path, $edit, t('Save field settings'));
     $this->assertText('Updated field Body field settings.');
     $this->drupalGet($field_edit_path);
-    $this->assertFieldByXPath("//select[@name='cardinality']", FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
-    $this->assertFieldByXPath("//input[@name='cardinality_number']", 1);
+    $this->assertSession()->fieldValueEquals('cardinality', FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
+    $this->assertSession()->fieldValueEquals('cardinality_number', 1);
 
     // Assert that you can't set the cardinality to a lower number then the
     // highest delta of this field but can set it to the same.
@@ -635,7 +635,7 @@ public function testHiddenFields() {
     // Check that the newly added field appears on the 'Manage Fields'
     // screen.
     $this->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields');
-    $this->assertFieldByXPath('//table[@id="field-overview"]//tr[@id="hidden-test-field"]//td[1]', $field['label'], 'Field was created and appears in the overview page.');
+    $this->assertSession()->elementTextContains('xpath', '//table[@id="field-overview"]//tr[@id="hidden-test-field"]//td[1]', $field['label']);
 
     // Check that the field does not appear in the 're-use existing field' row
     // on other bundles.
diff --git a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php
index 86b92df295f23c9fccac5d36277393df7a8ea88c..a8cb459adecdcbadd373cfc9e3da485f75a76362 100644
--- a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php
+++ b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php
@@ -58,7 +58,10 @@ public function fieldUIAddNewField($bundle_path, $field_name, $label = NULL, $fi
     $this->assertRaw(t('Saved %label configuration.', ['%label' => $label]));
 
     // Check that the field appears in the overview form.
-    $this->assertFieldByXPath('//table[@id="field-overview"]//tr/td[1]', $label, 'Field was created and appears in the overview page.');
+    $xpath = $this->assertSession()->buildXPathQuery("//table[@id=\"field-overview\"]//tr/td[1 and text() = :label]", [
+      ':label' => $label,
+    ]);
+    $this->assertSession()->elementExists('xpath', $xpath);
   }
 
   /**
@@ -95,7 +98,10 @@ public function fieldUIAddExistingField($bundle_path, $existing_storage_name, $l
     $this->assertRaw(t('Saved %label configuration.', ['%label' => $label]));
 
     // Check that the field appears in the overview form.
-    $this->assertFieldByXPath('//table[@id="field-overview"]//tr/td[1]', $label, 'Field was created and appears in the overview page.');
+    $xpath = $this->assertSession()->buildXPathQuery("//table[@id=\"field-overview\"]//tr/td[1 and text() = :label]", [
+      ':label' => $label,
+    ]);
+    $this->assertSession()->elementExists('xpath', $xpath);
   }
 
   /**
@@ -123,7 +129,10 @@ public function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_la
     $this->assertRaw(t('The field %label has been deleted from the %type content type.', ['%label' => $label, '%type' => $bundle_label]));
 
     // Check that the field does not appear in the overview form.
-    $this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, 'Field does not appear in the overview page.');
+    $xpath = $this->assertSession()->buildXPathQuery('//table[@id="field-overview"]//span[@class="label-field" and text()= :label]', [
+      ':label' => $label,
+    ]);
+    $this->assertSession()->elementNotExists('xpath', $xpath);
   }
 
 }
diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
index 79684571c4e4a2536f2f3fd122bd2f216d28ab3b..38e18649b1b3fd5b4e79c5154a65feefa48aeec1 100644
--- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
@@ -143,8 +143,8 @@ public function testDefaultFileFieldDisplay() {
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
 
     $this->drupalGet('node/' . $nid . '/edit');
-    $this->assertFieldByXPath('//input[@type="checkbox" and @name="' . $field_name . '[0][display]"]', NULL, 'Default file display checkbox field exists.');
-    $this->assertFieldByXPath('//input[@type="checkbox" and @name="' . $field_name . '[0][display]" and not(@checked)]', NULL, 'Default file display is off.');
+    $this->assertSession()->fieldExists($field_name . '[0][display]');
+    $this->assertSession()->checkboxNotChecked($field_name . '[0][display]');
   }
 
   /**
@@ -218,7 +218,7 @@ public function testDescriptionDefaultFileFieldDisplay() {
 
     // Test default formatter.
     $this->drupalGet('node/' . $nid);
-    $this->assertFieldByXPath('//a[@href="' . $node->{$field_name}->entity->createFileUrl(FALSE) . '"]', $description);
+    $this->assertSession()->elementTextContains('xpath', '//a[@href="' . $node->{$field_name}->entity->createFileUrl(FALSE) . '"]', $description);
 
     // Change formatter to "Table of files".
     $display = \Drupal::entityTypeManager()->getStorage('entity_view_display')->load('node.' . $type_name . '.default');
@@ -228,7 +228,7 @@ public function testDescriptionDefaultFileFieldDisplay() {
     ])->save();
 
     $this->drupalGet('node/' . $nid);
-    $this->assertFieldByXPath('//a[@href="' . $node->{$field_name}->entity->createFileUrl(FALSE) . '"]', $description);
+    $this->assertSession()->elementTextContains('xpath', '//a[@href="' . $node->{$field_name}->entity->createFileUrl(FALSE) . '"]', $description);
   }
 
 }
diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
index 156326713cc9b112226bb887f45e0c995c6c7b65..4cfba900ae676eea1dbb083c28b0b3bc490ce749 100644
--- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
@@ -97,13 +97,13 @@ public function testSingleValuedWidget() {
 
     // Ensure the edit page has a remove button instead of an upload button.
     $this->drupalGet("node/$nid/edit");
-    $this->assertNoFieldByXPath('//input[@type="submit"]', t('Upload'), 'Node with file does not display the "Upload" button.');
-    $this->assertFieldByXpath('//input[@type="submit"]', t('Remove'), 'Node with file displays the "Remove" button.');
+    $this->assertSession()->buttonNotExists('Upload');
+    $this->assertSession()->buttonExists('Remove');
     $this->drupalPostForm(NULL, [], t('Remove'));
 
     // Ensure the page now has an upload button instead of a remove button.
-    $this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), 'After clicking the "Remove" button, it is no longer displayed.');
-    $this->assertFieldByXpath('//input[@type="submit"]', t('Upload'), 'After clicking the "Remove" button, the "Upload" button is displayed.');
+    $this->assertSession()->buttonNotExists('Remove');
+    $this->assertSession()->buttonExists('Upload');
     // Test label has correct 'for' attribute.
     $input = $this->xpath('//input[@name="files[' . $field_name . '_0]"]');
     $label = $this->xpath('//label[@for="' . $input[0]->getAttribute('id') . '"]');
@@ -149,7 +149,7 @@ public function testMultiValuedWidget() {
         $this->drupalPostForm(NULL, $edit, t('Upload'));
       }
     }
-    $this->assertNoFieldByXpath('//input[@type="submit"]', t('Upload'), 'After uploading 3 files for each field, the "Upload" button is no longer displayed.');
+    $this->assertSession()->buttonNotExists('Upload');
 
     $num_expected_remove_buttons = 6;
 
@@ -197,7 +197,7 @@ public function testMultiValuedWidget() {
     }
 
     // Ensure the page now has no Remove buttons.
-    $this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), 'After removing all files, there is no "Remove" button displayed.');
+    $this->assertSession()->buttonNotExists('Remove');
 
     // Save the node and ensure it does not have any files.
     $this->drupalPostForm(NULL, ['title[0][value]' => $this->randomMachineName()], t('Save'));
@@ -272,12 +272,12 @@ public function testPrivateFileSetting() {
     // Ensure we can't change 'uri_scheme' field settings while there are some
     // entities with uploaded files.
     $this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_id/storage");
-    $this->assertFieldByXpath('//input[@id="edit-settings-uri-scheme-public" and @disabled="disabled"]', 'public', 'Upload destination setting disabled.');
+    $this->assertSession()->fieldDisabled("edit-settings-uri-scheme-public");
 
     // Delete node and confirm that setting could be changed.
     $node->delete();
     $this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_id/storage");
-    $this->assertFieldByXpath('//input[@id="edit-settings-uri-scheme-public" and not(@disabled)]', 'public', 'Upload destination setting enabled.');
+    $this->assertSession()->fieldEnabled("edit-settings-uri-scheme-public");
   }
 
   /**
diff --git a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
index 8b2176f446018cbb92b160b15032dfa70da186b4..872aa9e09b1f8e666e0c441484fb3c1c4b303080 100644
--- a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
+++ b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
@@ -24,7 +24,8 @@ class FileManagedFileElementTest extends FileFieldTestBase {
   public function testManagedFile() {
     // Check that $element['#size'] is passed to the child upload element.
     $this->drupalGet('file/test');
-    $this->assertFieldByXpath('//input[@name="files[nested_file]" and @size="13"]', NULL, 'The custom #size attribute is passed to the child upload element.');
+    $field = $this->assertSession()->fieldExists("files[nested_file]");
+    $this->assertEquals(13, $field->getAttribute('size'));
 
     // Perform the tests with all permutations of $form['#tree'],
     // $element['#extended'], and $element['#multiple'].
@@ -115,12 +116,12 @@ public function testManagedFile() {
     // Add a single file to the upload field.
     $this->drupalPostForm(NULL, $edit, t('Upload'));
     $fid_list[] = $this->getLastFileId();
-    $this->assertFieldByXpath('//input[@name="nested[file][file_' . $fid_list[0] . '][selected]"]', NULL, 'First file successfully uploaded to multiple file element.');
+    $this->assertSession()->fieldExists("nested[file][file_{$fid_list[0]}][selected]");
 
     // Add another file to the same upload field.
     $this->drupalPostForm(NULL, $edit, t('Upload'));
     $fid_list[] = $this->getLastFileId();
-    $this->assertFieldByXpath('//input[@name="nested[file][file_' . $fid_list[1] . '][selected]"]', NULL, 'Second file successfully uploaded to multiple file element.');
+    $this->assertSession()->fieldExists("nested[file][file_{$fid_list[1]}][selected]");
 
     // Save the entire form.
     $this->drupalPostForm(NULL, [], t('Save'));
@@ -134,8 +135,8 @@ public function testManagedFile() {
     $this->drupalPostForm($path . '/' . implode(',', $fid_list), $edit, t('Remove selected'));
 
     // Check that the first file has been deleted but not the second.
-    $this->assertNoFieldByXpath('//input[@name="nested[file][file_' . $fid_list[0] . '][selected]"]', NULL, 'An individual file can be deleted from a multiple file element.');
-    $this->assertFieldByXpath('//input[@name="nested[file][file_' . $fid_list[1] . '][selected]"]', NULL, 'Second individual file not deleted when the first file is deleted from a multiple file element.');
+    $this->assertSession()->fieldNotExists("nested[file][file_{$fid_list[0]}][selected]");
+    $this->assertSession()->fieldExists("nested[file][file_{$fid_list[1]}][selected]");
   }
 
   /**
diff --git a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php
index 1d23e945e04600a465e673a41c3a65e07dcc4c29..3a0fedae7dced421710922a1d57f3492f4437173 100644
--- a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php
+++ b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php
@@ -235,7 +235,8 @@ public function testFormatWidgetPermissions() {
     $this->clickLink(t('Edit'));
 
     // Verify that body field is read-only and contains replacement value.
-    $this->assertFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
+    $this->assertSession()->fieldDisabled($body_value_key);
+    $this->assertSession()->fieldValueEquals($body_value_key, 'This field has been disabled because you do not have sufficient permissions to edit it.');
 
     // Verify that title can be changed, but preview displays original body.
     $new_edit = [];
@@ -256,7 +257,8 @@ public function testFormatWidgetPermissions() {
     // else.)
     $this->drupalLogin($this->filterAdminUser);
     $this->drupalGet('node/' . $node->id() . '/edit');
-    $this->assertFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
+    $this->assertSession()->fieldDisabled($body_value_key);
+    $this->assertSession()->fieldValueEquals($body_value_key, 'This field has been disabled because you do not have sufficient permissions to edit it.');
 
     // Disable the text format used above.
     $this->disallowedFormat->disable()->save();
@@ -267,14 +269,15 @@ public function testFormatWidgetPermissions() {
     // edit content that does not have an assigned format.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('node/' . $node->id() . '/edit');
-    $this->assertFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
+    $this->assertSession()->fieldDisabled($body_value_key);
+    $this->assertSession()->fieldValueEquals($body_value_key, 'This field has been disabled because you do not have sufficient permissions to edit it.');
 
     // Log back in as the filter administrator and verify that the body field
     // can be edited.
     $this->drupalLogin($this->filterAdminUser);
     $this->drupalGet('node/' . $node->id() . '/edit');
-    $this->assertNoFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", NULL, 'Text format access denied message not found.');
-    $this->assertFieldByXPath("//select[@name='$body_format_key']", NULL, 'Text format selector found.');
+    $this->assertSession()->fieldEnabled($body_value_key);
+    $this->assertSession()->fieldExists($body_format_key);
 
     // Verify that trying to save the node without selecting a new text format
     // produces an error message, and does not result in the node being saved.
diff --git a/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php b/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php
index 3e2bce273af6533b506673cbe4116d85e4ddb7d1..b04726a1014b69b15813371455e7f3379472e498 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php
@@ -129,46 +129,18 @@ public function testDefaultImages() {
     // form.
     $field_id = $field->id();
     $this->drupalGet("admin/structure/types/manage/article/fields/$field_id/storage");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      $default_images['field_storage']->id(),
-      new FormattableMarkup(
-        'Article image field storage default equals expected file ID of @fid.',
-        ['@fid' => $default_images['field_storage']->id()]
-      )
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', $default_images['field_storage']->id());
     // Confirm the defaults are present on the article field edit form.
     $this->drupalGet("admin/structure/types/manage/article/fields/$field_id");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      $default_images['field']->id(),
-      new FormattableMarkup(
-        'Article image field default equals expected file ID of @fid.',
-        ['@fid' => $default_images['field']->id()]
-      )
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', $default_images['field']->id());
 
     // Confirm the defaults are present on the page field storage settings form.
     $this->drupalGet("admin/structure/types/manage/page/fields/$field_id/storage");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      $default_images['field_storage']->id(),
-      new FormattableMarkup(
-        'Page image field storage default equals expected file ID of @fid.',
-        ['@fid' => $default_images['field_storage']->id()]
-      )
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', $default_images['field_storage']->id());
     // Confirm the defaults are present on the page field edit form.
     $field2_id = $field2->id();
     $this->drupalGet("admin/structure/types/manage/page/fields/$field2_id");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      $default_images['field2']->id(),
-      new FormattableMarkup(
-        'Page image field default equals expected file ID of @fid.',
-        ['@fid' => $default_images['field2']->id()]
-      )
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', $default_images['field2']->id());
 
     // Confirm that the image default is shown for a new article node.
     $article = $this->drupalCreateNode(['type' => 'article']);
@@ -210,14 +182,7 @@ public function testDefaultImages() {
     // Confirm that the new default is used on the article field storage
     // settings form.
     $this->drupalGet("admin/structure/types/manage/article/fields/$field_id/storage");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      $default_images['field_storage_new']->id(),
-      new FormattableMarkup(
-        'Updated image field storage default equals expected file ID of @fid.',
-        ['@fid' => $default_images['field_storage_new']->id()]
-      )
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', $default_images['field_storage_new']->id());
 
     // Reload the nodes and confirm the field defaults are used.
     $node_storage->resetCache([$article->id(), $page->id()]);
@@ -248,14 +213,7 @@ public function testDefaultImages() {
 
     // Confirm the new field default is used on the article field admin form.
     $this->drupalGet("admin/structure/types/manage/article/fields/$field_id");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      $default_images['field_new']->id(),
-      new FormattableMarkup(
-        'Updated article image field default equals expected file ID of @fid.',
-        ['@fid' => $default_images['field_new']->id()]
-      )
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', $default_images['field_new']->id());
 
     // Reload the nodes.
     $node_storage->resetCache([$article->id(), $page->id()]);
@@ -294,11 +252,7 @@ public function testDefaultImages() {
 
     // Confirm the article field default has been removed.
     $this->drupalGet("admin/structure/types/manage/article/fields/$field_id");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      '',
-      'Updated article image field default has been successfully removed.'
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', '');
 
     // Reload the nodes.
     $node_storage->resetCache([$article->id(), $page->id()]);
@@ -344,14 +298,7 @@ public function testDefaultImages() {
     // Confirm that the new default is used on the article field storage
     // settings form.
     $this->drupalGet("admin/structure/types/manage/article/fields/$field_id/storage");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      $default_images['field_storage_private']->id(),
-      new FormattableMarkup(
-        'Updated image field storage default equals expected file ID of @fid.',
-        ['@fid' => $default_images['field_storage_private']->id()]
-      )
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', $default_images['field_storage_private']->id());
 
     // Upload a new default for the article's field after setting the field
     // storage upload destination to 'private'.
@@ -363,14 +310,7 @@ public function testDefaultImages() {
     // Confirm the new field field default is used on the article field
     // admin form.
     $this->drupalGet("admin/structure/types/manage/article/fields/$field_id");
-    $this->assertFieldByXpath(
-      '//input[@name="settings[default_image][uuid][fids]"]',
-      $default_images['field_private']->id(),
-      new FormattableMarkup(
-        'Updated article image field default equals expected file ID of @fid.',
-        ['@fid' => $default_images['field_private']->id()]
-      )
-    );
+    $this->assertSession()->hiddenFieldValueEquals('settings[default_image][uuid][fids]', $default_images['field_private']->id());
   }
 
   /**
diff --git a/core/modules/language/tests/src/Functional/LanguageBlockSettingsVisibilityTest.php b/core/modules/language/tests/src/Functional/LanguageBlockSettingsVisibilityTest.php
index 968957c899d990b24949ba576c15b45f3988ac1a..64d9b241c731a445d4fe13669cfc626671aa1d53 100644
--- a/core/modules/language/tests/src/Functional/LanguageBlockSettingsVisibilityTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageBlockSettingsVisibilityTest.php
@@ -27,10 +27,10 @@ public function testUnnecessaryLanguageSettingsVisibility() {
     $this->drupalLogin($admin_user);
     $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'hu'], t('Add language'));
     $this->drupalGet('admin/structure/block/add/system_menu_block:admin/stark');
-    $this->assertNoFieldByXPath('//input[@id="edit-visibility-language-langcodes-und"]', NULL, '\'Not specified\' option does not appear at block config, language settings section.');
-    $this->assertNoFieldByXpath('//input[@id="edit-visibility-language-langcodes-zxx"]', NULL, '\'Not applicable\' option does not appear at block config, language settings section.');
-    $this->assertFieldByXPath('//input[@id="edit-visibility-language-langcodes-en"]', NULL, '\'English\' option appears at block config, language settings section.');
-    $this->assertFieldByXpath('//input[@id="edit-visibility-language-langcodes-hu"]', NULL, '\'Hungarian\' option appears at block config, language settings section.');
+    $this->assertSession()->fieldNotExists("edit-visibility-language-langcodes-und");
+    $this->assertSession()->fieldNotExists("edit-visibility-language-langcodes-zxx");
+    $this->assertSession()->fieldExists("edit-visibility-language-langcodes-en");
+    $this->assertSession()->fieldExists("edit-visibility-language-langcodes-hu");
   }
 
 }
diff --git a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
index c0f417a350e3a49a89557e2d3ce58acae0f4f15c..16d782031d14738745f1c558df7367a890cd280f 100644
--- a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
@@ -44,11 +44,12 @@ public function testLanguageConfiguration() {
 
     // Check if the Default English language has no path prefix.
     $this->drupalGet('admin/config/regional/language/detection/url');
-    $this->assertFieldByXPath('//input[@name="prefix[en]"]', '', 'Default English has no path prefix.');
+    $this->assertSession()->fieldValueEquals("prefix[en]", '');
 
     // Check that Add language is a primary button.
     $this->drupalGet('admin/config/regional/language/add');
-    $this->assertFieldByXPath('//input[contains(@class, "button--primary")]', 'Add language', 'Add language is a primary button');
+    $button = $this->assertSession()->buttonExists('Add language');
+    $this->assertTrue($button->hasClass("button--primary"));
 
     // Add predefined language.
     $edit = [
@@ -63,10 +64,10 @@ public function testLanguageConfiguration() {
 
     // Check if the Default English language has no path prefix.
     $this->drupalGet('admin/config/regional/language/detection/url');
-    $this->assertFieldByXPath('//input[@name="prefix[en]"]', '', 'Default English has no path prefix.');
+    $this->assertSession()->fieldValueEquals("prefix[en]", '');
     // Check if French has a path prefix.
     $this->drupalGet('admin/config/regional/language/detection/url');
-    $this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'fr', 'French has a path prefix.');
+    $this->assertSession()->fieldValueEquals("prefix[fr]", 'fr');
 
     // Check if we can change the default language.
     $this->drupalGet('admin/config/regional/language');
@@ -84,17 +85,17 @@ public function testLanguageConfiguration() {
     // Check if a valid language prefix is added after changing the default
     // language.
     $this->drupalGet('admin/config/regional/language/detection/url');
-    $this->assertFieldByXPath('//input[@name="prefix[en]"]', 'en', 'A valid path prefix has been added to the previous default language.');
+    $this->assertSession()->fieldValueEquals("prefix[en]", 'en');
     // Check if French still has a path prefix.
     $this->drupalGet('admin/config/regional/language/detection/url');
-    $this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'fr', 'French still has a path prefix.');
+    $this->assertSession()->fieldValueEquals("prefix[fr]", 'fr');
 
     // Check that prefix can be changed.
     $edit = [
       'prefix[fr]' => 'french',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
-    $this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'french', 'French path prefix has changed.');
+    $this->assertSession()->fieldValueEquals("prefix[fr]", 'french');
 
     // Check that the prefix can be removed.
     $edit = [
diff --git a/core/modules/locale/tests/src/Functional/LocaleContentTest.php b/core/modules/locale/tests/src/Functional/LocaleContentTest.php
index 1aa2219439ff42b1e0097b389ce5cb80cb0e1858..a70c16a565884e4ff7997f29e8611b348a4c8952 100644
--- a/core/modules/locale/tests/src/Functional/LocaleContentTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleContentTest.php
@@ -43,7 +43,8 @@ public function testMachineNameLTR() {
 
     // Verify that the machine name field is LTR for a new content type.
     $this->drupalGet('admin/structure/types/add');
-    $this->assertFieldByXpath('//input[@name="type" and @dir="ltr"]', NULL, 'The machine name field is LTR when no additional language is configured.');
+    $type = $this->assertSession()->fieldExists('type');
+    $this->assertSame('ltr', $type->getAttribute('dir'));
 
     // Install the Arabic language (which is RTL) and configure as the default.
     $edit = [];
@@ -57,7 +58,8 @@ public function testMachineNameLTR() {
 
     // Verify that the machine name field is still LTR for a new content type.
     $this->drupalGet('admin/structure/types/add');
-    $this->assertFieldByXpath('//input[@name="type" and @dir="ltr"]', NULL, 'The machine name field is LTR when the default language is RTL.');
+    $type = $this->assertSession()->fieldExists('type');
+    $this->assertSame('ltr', $type->getAttribute('dir'));
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/NodeSyndicateBlockTest.php b/core/modules/node/tests/src/Functional/NodeSyndicateBlockTest.php
index 2cf6e8bbc8e98848423d4de3558218bd94d29497..4fd853ad67fd6c445784f94ee46ae8579e436ee8 100644
--- a/core/modules/node/tests/src/Functional/NodeSyndicateBlockTest.php
+++ b/core/modules/node/tests/src/Functional/NodeSyndicateBlockTest.php
@@ -36,7 +36,7 @@ public function testSyndicateBlock() {
     // Place the "Syndicate" block and confirm that it is rendered.
     $this->drupalPlaceBlock('node_syndicate_block', ['id' => 'test_syndicate_block']);
     $this->drupalGet('');
-    $this->assertFieldByXPath('//div[@id="block-test-syndicate-block"]/*', NULL, 'Syndicate block found.');
+    $this->assertSession()->elementExists('xpath', '//div[@id="block-test-syndicate-block"]/*');
   }
 
 }
diff --git a/core/modules/path/tests/src/Functional/PathAliasTest.php b/core/modules/path/tests/src/Functional/PathAliasTest.php
index 3772e2b7ede6efe9b62964a40f0ed603cfb01a9d..5ebaadae8948a98d8627c12ca530c72806fe1f24 100644
--- a/core/modules/path/tests/src/Functional/PathAliasTest.php
+++ b/core/modules/path/tests/src/Functional/PathAliasTest.php
@@ -402,7 +402,9 @@ public function testDuplicateNodeAlias() {
     $node_two = $this->drupalCreateNode();
     $this->drupalPostForm('node/' . $node_two->id() . '/edit', $edit, t('Save'));
     $this->assertSession()->pageTextContains("The alias {$edit['path[0][alias]']} is already in use in this language.");
-    $this->assertFieldByXPath("//input[@name='path[0][alias]' and contains(@class, 'error')]", $edit['path[0][alias]'], 'Textfield exists and has the error class.');
+    $path_alias = $this->assertSession()->fieldExists('path[0][alias]');
+    $this->assertSession()->fieldValueEquals('path[0][alias]', $edit['path[0][alias]']);
+    $this->assertTrue($path_alias->hasClass('error'));
 
     // Behavior here differs with the inline_form_errors module enabled.
     // Enable the inline_form_errors module and try this again. This module
diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
index ab712f6a9a22a74c4332b23d464e8a9e7b4ba136..25df4a33151d74cf9ffb6fa7b10586140838434f 100644
--- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
+++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
@@ -135,7 +135,7 @@ public function testUserPermissions() {
     // permission to in-place edit.
     $this->assertNoRaw('data-quickedit-entity-id="node/1"');
     $this->assertNoRaw('data-quickedit-field-id="node/1/body/en/full"');
-    $this->assertNoFieldByXPath('//h1[contains(@class, "js-quickedit-page-title")]');
+    $this->assertSession()->elementNotExists('xpath', '//h1[contains(@class, "js-quickedit-page-title")]');
     $assert->linkNotExists('Quick edit');
 
     // Tests the loading of Quick Edit when a user does have access to it.
diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
index d493413deec6549661f62a03d6057d4e10910482..ca668470982199b0394faa7943eeac424ecadd65 100644
--- a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
+++ b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
@@ -151,7 +151,8 @@ public function testShortcutSetSwitchNoSetName() {
     $this->assertText(t('The new set label is required.'));
     $current_set = shortcut_current_displayed_set($this->adminUser);
     $this->assertEqual($current_set->id(), $this->set->id(), 'Attempting to switch to a new shortcut set without providing a set name does not succeed.');
-    $this->assertFieldByXPath("//input[@name='label' and contains(concat(' ', normalize-space(@class), ' '), ' error ')]", NULL, 'The new set label field has the error class');
+    $field = $this->assertSession()->fieldExists('label');
+    $this->assertTrue($field->hasClass('error'));
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
index f031187c1b6e862a1c2f8ae8d307dc85d3125b62..005601379d114e75ce013992b5d1c4bd955cd6cb 100644
--- a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
@@ -31,7 +31,7 @@ public function testConfirmForm() {
     $site_name = $this->config('system.site')->get('name');
     $this->assertSession()->titleEquals("ConfirmFormTestForm::getQuestion(). | $site_name");
     $this->assertText(t('ConfirmFormTestForm::getDescription().'), 'The description was used.');
-    $this->assertFieldByXPath('//input[@id="edit-submit"]', t('ConfirmFormTestForm::getConfirmText().'), 'The confirm text was used.');
+    $this->assertSession()->buttonExists('ConfirmFormTestForm::getConfirmText().');
 
     // Test cancelling the form.
     $this->clickLink(t('ConfirmFormTestForm::getCancelText().'));
diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php
index 256cc67e199e6f662a9e80e5c2517ec8fc018e15..f6be136a4b9a4586b1a3063c68458f01f7a707ba 100644
--- a/core/modules/system/tests/src/Functional/Form/FormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormTest.php
@@ -232,7 +232,9 @@ public function testRequiredCheckboxesRadio() {
       'radios' => 'bar',
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
-    $this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed when all required fields are filled.');
+    // Verify that no error message is displayed when all required fields are
+    // filled.
+    $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "error")]');
     $this->assertRaw("The form_test_validate_required_form form was submitted successfully.");
   }
 
@@ -259,7 +261,9 @@ public function testInputWithInvalidToken() {
       'radios' => 'foo',
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
-    $this->assertFieldByXpath('//div[contains(@class, "error")]', NULL, 'Error message is displayed with invalid token even when required fields are filled.');
+    // Verify that error message is displayed with invalid token even when
+    // required fields are filled.
+    $this->assertSession()->elementExists('xpath', '//div[contains(@class, "error")]');
 
     $assert = $this->assertSession();
     $element = $assert->fieldExists('textfield');
@@ -283,7 +287,9 @@ public function testInputWithInvalidToken() {
       'textarea' => $this->randomString() . "\n",
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
-    $this->assertFieldByXpath('//div[contains(@class, "error")]', NULL, 'Error message is displayed with invalid token even when required fields are filled.');
+    // Verify that the error message is displayed with invalid token even when
+    // required fields are filled.
+    $this->assertSession()->elementExists('xpath', '//div[contains(@class, "error")]');
     $this->assertText('The form has become outdated.');
     $this->assertSession()->fieldValueEquals('textfield', '');
     $this->assertSession()->fieldValueEquals('textarea', '');
@@ -299,7 +305,9 @@ public function testInputWithInvalidToken() {
       'integer_step' => mt_rand(6, 100),
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
-    $this->assertFieldByXpath('//div[contains(@class, "error")]', NULL, 'Error message is displayed with invalid token even when required fields are filled.');
+    // Verify that the error message is displayed with invalid token even when
+    // required fields are filled.'
+    $this->assertSession()->elementExists('xpath', '//div[contains(@class, "error")]');
     $this->assertText('The form has become outdated.');
     $this->assertSession()->fieldValueEquals('integer_step', 5);
 
@@ -312,7 +320,9 @@ public function testInputWithInvalidToken() {
       'url' => $this->randomString(),
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
-    $this->assertFieldByXpath('//div[contains(@class, "error")]', NULL, 'Error message is displayed with invalid token even when required fields are filled.');
+    // Verify that the error message is displayed with invalid token even when
+    // required fields are filled.
+    $this->assertSession()->elementExists('xpath', '//div[contains(@class, "error")]');
     $this->assertText('The form has become outdated.');
     $this->assertSession()->fieldValueEquals('url', '');
   }
@@ -346,10 +356,10 @@ public function testRequiredTextfieldNoTitle() {
     $this->assertNoRaw("The form_test_validate_required_form_no_title form was submitted successfully.");
 
     // Check the page for the error class on the textfield.
-    $this->assertFieldByXPath('//input[contains(@class, "error")]', FALSE, 'Error input form element class found.');
+    $this->assertSession()->elementExists('xpath', '//input[contains(@class, "error")]');
 
     // Check the page for the aria-invalid attribute on the textfield.
-    $this->assertFieldByXPath('//input[contains(@aria-invalid, "true")]', FALSE, 'Aria invalid attribute found.');
+    $this->assertSession()->elementExists('xpath', '//input[contains(@aria-invalid, "true")]');
 
     // Submit again with required fields set and verify that there are no
     // error messages.
@@ -357,7 +367,8 @@ public function testRequiredTextfieldNoTitle() {
       'textfield' => $this->randomString(),
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
-    $this->assertNoFieldByXpath('//input[contains(@class, "error")]', FALSE, 'No error input form element class found.');
+    // Verify that no error input form element class is present.
+    $this->assertSession()->elementNotExists('xpath', '//input[contains(@class, "error")]');
     $this->assertRaw("The form_test_validate_required_form_no_title form was submitted successfully.");
   }
 
@@ -474,8 +485,8 @@ public function testSelect() {
    */
   public function testEmptySelect() {
     $this->drupalGet('form-test/empty-select');
-    $this->assertFieldByXPath("//select[1]", NULL, 'Select element found.');
-    $this->assertNoFieldByXPath("//select[1]/option", NULL, 'No option element found.');
+    $this->assertSession()->elementExists('xpath', "//select[1]");
+    $this->assertSession()->elementNotExists('xpath', "//select[1]/option");
   }
 
   /**
@@ -674,7 +685,8 @@ public function testRange() {
     $this->assertEqual($values->offset, 6.9);
 
     $this->drupalPostForm('form-test/range/invalid', [], 'Submit');
-    $this->assertFieldByXPath('//input[@type="range" and contains(@class, "error")]', NULL, 'Range element has the error class.');
+    // Verify that the 'range' element has the error class.
+    $this->assertSession()->elementExists('xpath', '//input[@type="range" and contains(@class, "error")]');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php b/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php
index a9766f5492219020d52045d09bdcdf974012ad57..fb94dd163503f4848022560072d94a5068046031 100644
--- a/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php
@@ -41,13 +41,13 @@ public function testModuleListForm() {
     $this->drupalGet('admin/modules');
 
     // Check that system_test's configure link was rendered correctly.
-    $this->assertFieldByXPath("//a[contains(@href, '/system-test/configure/bar') and text()='Configure ']/span[contains(@class, 'visually-hidden') and text()='the System test module']");
+    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/system-test/configure/bar') and text()='Configure ']/span[contains(@class, 'visually-hidden') and text()='the System test module']");
 
     // Check that system_test's permissions link was rendered correctly.
-    $this->assertFieldByXPath("//a[contains(@href, '/admin/people/permissions#module-system_test') and @title='Configure permissions']");
+    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/admin/people/permissions#module-system_test') and @title='Configure permissions']");
 
     // Check that system_test's help link was rendered correctly.
-    $this->assertFieldByXPath("//a[contains(@href, '/admin/help/system_test') and @title='Help']");
+    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/admin/help/system_test') and @title='Help']");
 
     // Ensure that the Database Logging module's machine name is printed. This
     // module is used because its machine name is different than its human
diff --git a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
index 5ddba8bfe0ded3e9dadf81fddfdcdc8295c85e1e..5ee85c847b27b22eff47bd09d81183c43ac31501 100644
--- a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
@@ -158,8 +158,7 @@ public function testUninstall() {
     // Test an entity type which does not have any existing entities.
     $this->drupalGet('admin/modules/uninstall/entity/entity_test_no_label');
     $this->assertText('There are 0 entity test without label entities to delete.');
-    $button_xpath = '//input[@type="submit"][@value="Delete all entity test without label entities"]';
-    $this->assertNoFieldByXPath($button_xpath, NULL, 'Button with value "Delete all entity test without label entities" not found');
+    $this->assertSession()->buttonNotExists("Delete all entity test without label entities");
 
     // Test an entity type without a label.
     /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
@@ -171,7 +170,7 @@ public function testUninstall() {
     ])->save();
     $this->drupalGet('admin/modules/uninstall/entity/entity_test_no_label');
     $this->assertText('This will delete 1 entity test without label.');
-    $this->assertFieldByXPath($button_xpath, NULL, 'Button with value "Delete all entity test without label entities" found');
+    $this->assertSession()->buttonExists("Delete all entity test without label entities");
     $storage->create([
       'id' => mb_strtolower($this->randomMachineName()),
       'name' => $this->randomMachineName(),
diff --git a/core/modules/user/tests/src/Functional/UserCreateTest.php b/core/modules/user/tests/src/Functional/UserCreateTest.php
index f9037d9aed2dd554c13842dfd5e65b1e223bd161..04bddfdcb60dc2ee57dc951a4d8c0baa65ae36f9 100644
--- a/core/modules/user/tests/src/Functional/UserCreateTest.php
+++ b/core/modules/user/tests/src/Functional/UserCreateTest.php
@@ -78,7 +78,7 @@ public function testUserAdd() {
     $this->drupalGet('admin/people/create');
     $this->assertSession()->fieldValueEquals('edit-status-0', '1');
     $this->assertSession()->fieldValueEquals('edit-status-1', '1');
-    $this->assertFieldByXPath('//input[@type="radio" and @id="edit-status-1" and @checked="checked"]', NULL, 'Default setting for user status is active.');
+    $this->assertSession()->checkboxChecked('edit-status-1');
 
     // Test that browser autocomplete behavior does not occur.
     $this->assertNoRaw('data-user-info-from-browser');
diff --git a/core/modules/user/tests/src/Functional/UserLoginTest.php b/core/modules/user/tests/src/Functional/UserLoginTest.php
index eafa70d7d59cfb24f10e198b6bfbb333a15f4dbd..ed3cadfae0d0a3e3b780a853f1e038d12dad67c5 100644
--- a/core/modules/user/tests/src/Functional/UserLoginTest.php
+++ b/core/modules/user/tests/src/Functional/UserLoginTest.php
@@ -172,9 +172,9 @@ public function assertFailedLogin($account, $flood_trigger = NULL) {
       'pass' => $account->passRaw,
     ];
     $this->drupalPostForm('user/login', $edit, t('Log in'));
-    $this->assertNoFieldByXPath("//input[@name='pass' and @value!='']", NULL, 'Password value attribute is blank.');
     if (isset($flood_trigger)) {
       $this->assertSession()->statusCodeEquals(403);
+      $this->assertSession()->fieldNotExists('pass');
       $last_log = $database->select('watchdog', 'w')
         ->fields('w', ['message'])
         ->condition('type', 'user')
@@ -194,6 +194,7 @@ public function assertFailedLogin($account, $flood_trigger = NULL) {
     }
     else {
       $this->assertSession()->statusCodeEquals(200);
+      $this->assertSession()->fieldValueEquals('pass', '');
       $this->assertText(t('Unrecognized username or password. Forgot your password?'));
     }
   }
diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
index aa0cd470ff83a34cc9d50eb814b25a5c35e40cee..ac8c7aa28da98c2a775fb8c0f8fc8d98b1ac6cf6 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
@@ -239,7 +239,7 @@ public function testExposedBlock() {
     $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.');
+    $this->assertSession()->elementNotExists('xpath', $xpath);
 
     // Test there is only one views exposed form on the page.
     $elements = $this->xpath('//form[@id=:id]', [':id' => $this->getExpectedExposedFormId($view)]);
diff --git a/core/modules/views/tests/src/Functional/Plugin/PagerTest.php b/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
index 1c83495754e777606b4a3b6a45bb850508b19c1d..3c7b7c933df724f2aa82ee65f94f2ee08145d3c6 100644
--- a/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
@@ -66,26 +66,55 @@ public function testStorePagerSettings() {
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply'));
 
-    $this->assertFieldByXPath('//input[@name="pager_options[items_per_page]" and @type="number" and @min="0"]', 10, '"Items per page" field was found.');
-    $this->assertFieldByXPath('//input[@name="pager_options[offset]" and @type="number" and @min="0"]', 0, '"Offset" field was found.');
+    $items_per_page = $this->assertSession()->fieldExists("pager_options[items_per_page]");
+    $this->assertSession()->fieldValueEquals("pager_options[items_per_page]", 10);
+    $this->assertSame('number', $items_per_page->getAttribute('type'));
+    $this->assertEquals(0, $items_per_page->getAttribute('min'));
+
+    $offset = $this->assertSession()->fieldExists("pager_options[offset]");
+    $this->assertSession()->fieldValueEquals("pager_options[offset]", 0);
+    $this->assertSame('number', $offset->getAttribute('type'));
+    $this->assertEquals(0, $offset->getAttribute('min'));
 
     $edit = [
       'pager[type]' => 'none',
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply'));
 
-    $this->assertFieldByXPath('//input[@name="pager_options[offset]" and @type="number" and @min="0"]', 0, '"Offset" field was found.');
+    $offset = $this->assertSession()->fieldExists("pager_options[offset]");
+    $this->assertSession()->fieldValueEquals("pager_options[offset]", 0);
+    $this->assertSame('number', $offset->getAttribute('type'));
+    $this->assertEquals(0, $offset->getAttribute('min'));
 
     $edit = [
       'pager[type]' => 'full',
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply'));
 
-    $this->assertFieldByXPath('//input[@name="pager_options[items_per_page]" and @type="number" and @min="0"]', 10, '"Items to display" field was found.');
-    $this->assertFieldByXPath('//input[@name="pager_options[offset]" and @type="number" and @min="0"]', 0, '"Offset" field was found.');
-    $this->assertFieldByXPath('//input[@name="pager_options[id]" and @type="number" and @min="0"]', 0, '"Pager ID" field was found.');
-    $this->assertFieldByXPath('//input[@name="pager_options[total_pages]" and @type="number" and @min="0"]', '', '"Number of pages" field was found.');
-    $this->assertFieldByXPath('//input[@name="pager_options[quantity]" and @type="number" and @min="0"]', 9, '"Number of pager links" field was found.');
+    $items_per_page = $this->assertSession()->fieldExists("pager_options[items_per_page]");
+    $this->assertSession()->fieldValueEquals("pager_options[items_per_page]", 10);
+    $this->assertSame('number', $items_per_page->getAttribute('type'));
+    $this->assertEquals(0, $items_per_page->getAttribute('min'));
+
+    $offset = $this->assertSession()->fieldExists("pager_options[offset]");
+    $this->assertSession()->fieldValueEquals("pager_options[offset]", 0);
+    $this->assertSame('number', $offset->getAttribute('type'));
+    $this->assertEquals(0, $offset->getAttribute('min'));
+
+    $id = $this->assertSession()->fieldExists("pager_options[id]");
+    $this->assertSession()->fieldValueEquals("pager_options[id]", 0);
+    $this->assertSame('number', $id->getAttribute('type'));
+    $this->assertEquals(0, $id->getAttribute('min'));
+
+    $total_pages = $this->assertSession()->fieldExists("pager_options[total_pages]");
+    $this->assertSession()->fieldValueEquals("pager_options[total_pages]", '');
+    $this->assertSame('number', $total_pages->getAttribute('type'));
+    $this->assertEquals(0, $total_pages->getAttribute('min'));
+
+    $quantity = $this->assertSession()->fieldExists("pager_options[quantity]");
+    $this->assertSession()->fieldValueEquals("pager_options[quantity]", 9);
+    $this->assertSame('number', $quantity->getAttribute('type'));
+    $this->assertEquals(0, $quantity->getAttribute('min'));
 
     $edit = [
       'pager_options[items_per_page]' => 20,
@@ -152,10 +181,25 @@ public function testStorePagerSettings() {
     $this->drupalGet('admin/structure/views/nojs/display/test_store_pager_settings/page_1/pager_options');
     $this->assertSession()->fieldNotExists('override[dropdown]');
 
-    $this->assertFieldByXPath('//input[@name="pager_options[items_per_page]" and @type="number" and @min="0"]', 20, '"Items per page" field was found.');
-    $this->assertFieldByXPath('//input[@name="pager_options[offset]" and @type="number" and @min="0"]', 0, '"Offset" field was found.');
-    $this->assertFieldByXPath('//input[@name="pager_options[id]" and @type="number" and @min="0"]', 0, '"Pager ID" field was found.');
-    $this->assertFieldByXPath('//input[@name="pager_options[total_pages]" and @type="number" and @min="0"]', '', '"Number of pages" field was found.');
+    $items_per_page = $this->assertSession()->fieldExists("pager_options[items_per_page]");
+    $this->assertSession()->fieldValueEquals("pager_options[items_per_page]", 20);
+    $this->assertSame('number', $items_per_page->getAttribute('type'));
+    $this->assertEquals(0, $items_per_page->getAttribute('min'));
+
+    $offset = $this->assertSession()->fieldExists("pager_options[offset]");
+    $this->assertSession()->fieldValueEquals("pager_options[offset]", 0);
+    $this->assertSame('number', $offset->getAttribute('type'));
+    $this->assertEquals(0, $offset->getAttribute('min'));
+
+    $id = $this->assertSession()->fieldExists("pager_options[id]");
+    $this->assertSession()->fieldValueEquals("pager_options[id]", 0);
+    $this->assertSame('number', $id->getAttribute('type'));
+    $this->assertEquals(0, $id->getAttribute('min'));
+
+    $total_pages = $this->assertSession()->fieldExists("pager_options[total_pages]");
+    $this->assertSession()->fieldValueEquals("pager_options[total_pages]", '');
+    $this->assertSame('number', $total_pages->getAttribute('type'));
+    $this->assertEquals(0, $total_pages->getAttribute('min'));
   }
 
   /**
diff --git a/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php b/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php
index 53c12604c9b92cbbbc0a4f229eaf0cd4f49c670f..bcf42f274b7e5eb9732df07deac068a990609adc 100644
--- a/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php
@@ -193,15 +193,14 @@ public function testTaggedWithByNodeType() {
     // by default (when the wizard is configured to display all content) and
     // also when the node type that has the tagging field is selected, but not
     // when the node type that doesn't have the tagging field is selected.
-    $tags_xpath = '//input[@name="show[tagged_with]"]';
     $this->drupalGet('admin/structure/views/add');
-    $this->assertFieldByXpath($tags_xpath);
+    $this->assertSession()->fieldExists("show[tagged_with]");
     $view['show[type]'] = $this->nodeTypeWithTags->id();
     $this->drupalPostForm('admin/structure/views/add', $view, t('Update "of type" choice'));
-    $this->assertFieldByXpath($tags_xpath);
+    $this->assertSession()->fieldExists("show[tagged_with]");
     $view['show[type]'] = $this->nodeTypeWithoutTags->id();
     $this->drupalPostForm(NULL, $view, t('Update "of type" choice (2)'));
-    $this->assertNoFieldByXpath($tags_xpath);
+    $this->assertSession()->fieldNotExists("show[tagged_with]");
 
     // If we add an instance of the tagging field to the second node type, the
     // "tagged with" form element should not appear for it too.
@@ -228,10 +227,10 @@ public function testTaggedWithByNodeType() {
 
     $view['show[type]'] = $this->nodeTypeWithTags->id();
     $this->drupalPostForm('admin/structure/views/add', $view, t('Update "of type" choice'));
-    $this->assertFieldByXpath($tags_xpath);
+    $this->assertSession()->fieldExists("show[tagged_with]");
     $view['show[type]'] = $this->nodeTypeWithoutTags->id();
     $this->drupalPostForm(NULL, $view, t('Update "of type" choice (2)'));
-    $this->assertFieldByXpath($tags_xpath);
+    $this->assertSession()->fieldExists("show[tagged_with]");
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php b/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
index b796b7d587ef7269e8d7ea16c2165491d2a71c89..f5de2f003ba3b4e299d21c45e56bcc1f85a1a461 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
@@ -77,12 +77,12 @@ protected function checkFeedViewUi($view_name) {
     $this->assertNoRaw('<em>Page</em>');
 
     $this->drupalGet('admin/structure/views/view/' . $view_name . '/edit/feed_1');
-    $this->assertFieldByXpath('//*[@id="views-feed-1-displays"]', '<em>Page</em>');
+    $this->assertSession()->elementTextContains('xpath', '//*[@id="views-feed-1-displays"]', 'Page');
 
     // Add the default display, so there should now be multiple displays.
     $this->drupalPostForm('admin/structure/views/nojs/display/' . $view_name . '/feed_1/displays', ['displays[default]' => 'default'], t('Apply'));
     $this->drupalGet('admin/structure/views/view/' . $view_name . '/edit/feed_1');
-    $this->assertFieldByXpath('//*[@id="views-feed-1-displays"]', 'Multiple displays');
+    $this->assertSession()->elementTextContains('xpath', '//*[@id="views-feed-1-displays"]', 'Multiple displays');
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayTest.php b/core/modules/views_ui/tests/src/Functional/DisplayTest.php
index e8f36e4a65eaa9de6d217d320e79c25592c2ce88..f4a663087d594389424106597bdcc35a6f3be9ad 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayTest.php
@@ -247,15 +247,15 @@ public function testActionLinks() {
     $this->assertNoRaw($display_title);
 
     // Ensure that the dropdown buttons are displayed correctly.
-    $this->assertFieldByXpath('//input[@type="submit"]', 'Duplicate ' . $display_title);
-    $this->assertFieldByXpath('//input[@type="submit"]', 'Delete ' . $display_title);
-    $this->assertFieldByXpath('//input[@type="submit"]', 'Disable ' . $display_title);
-    $this->assertNoFieldByXpath('//input[@type="submit"]', 'Enable ' . $display_title);
+    $this->assertSession()->buttonExists('Duplicate ' . $display_title);
+    $this->assertSession()->buttonExists('Delete ' . $display_title);
+    $this->assertSession()->buttonExists('Disable ' . $display_title);
+    $this->assertSession()->buttonNotExists('Enable ' . $display_title);
 
     // Disable the display so we can test the rendering of the "Enable" button.
     $this->drupalPostForm(NULL, [], 'Disable ' . $display_title);
-    $this->assertFieldByXpath('//input[@type="submit"]', 'Enable ' . $display_title);
-    $this->assertNoFieldByXpath('//input[@type="submit"]', 'Disable ' . $display_title);
+    $this->assertSession()->buttonExists('Enable ' . $display_title);
+    $this->assertSession()->buttonNotExists('Disable ' . $display_title);
 
     // Ensure that the title is escaped as expected.
     $this->assertSession()->assertEscaped($display_title);
diff --git a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
index beece8ce2b2dfc9b51842b1410922e74ddcb2967..4d955dad8969429f6cd3bc5dcff6a9e78fa2bb8e 100644
--- a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
@@ -126,11 +126,11 @@ public function testExposedAdminUi() {
     $view_id = $this->randomView()['id'];
     $this->drupalGet("admin/structure/views/nojs/add-handler/$view_id/default/sort");
     $this->drupalPostForm(NULL, ['name[node_field_data.created]' => 1], t('Add and configure @handler', ['@handler' => t('sort criteria')]));
-    $this->assertFieldByXPath('//input[@name="options[order]" and @checked="checked"]', 'ASC', 'The default order is set.');
+    $this->assertSession()->fieldValueEquals('options[order]', 'ASC');
     // Change the order and expose the sort.
     $this->drupalPostForm(NULL, ['options[order]' => 'DESC'], t('Apply'));
     $this->drupalPostForm("admin/structure/views/nojs/handler/$view_id/default/sort/created", [], t('Expose sort'));
-    $this->assertFieldByXPath('//input[@name="options[order]" and @checked="checked"]', 'DESC');
+    $this->assertSession()->fieldValueEquals('options[order]', 'DESC');
     $this->assertSession()->fieldValueEquals('options[expose][label]', 'Authored on');
     // Change the label and save the view.
     $edit = ['options[expose][label]' => $this->randomString()];
diff --git a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
index e6c4440f17f8e7d4a2dfb4fe411e3db49eb3f2e7..a1aeca6b1a4b317ecfcc92d5c47f3a6e1cce1a48 100644
--- a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
+++ b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
@@ -115,7 +115,8 @@ public function testOtherOptions() {
     $this->drupalPostForm('admin/structure/views/nojs/rearrange/test_view/default/field', $fields, t('Apply'));
     $this->drupalPostForm(NULL, [], 'Save');
     $this->drupalPostForm(NULL, [], t('Cancel'));
-    $this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed.');
+    // Verify that no error message is displayed.
+    $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "error")]');
     // Verify page was redirected to the view listing.
     $this->assertSession()->addressEquals('admin/structure/views');
   }
diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
index ac7e0dfba398aaac5204a90c0a376549e014bc3b..65c333b20d3f54506aaa59fad0d04c715ca6c674 100644
--- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
+++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
@@ -335,27 +335,27 @@ public function testXpathAsserts() {
     $this->drupalGet('test-field-xpath');
     $this->assertFieldsByValue($this->xpath("//h1[@class = 'page-title']"), NULL);
     $this->assertFieldsByValue($this->xpath('//table/tbody/tr[2]/td[1]'), 'one');
-    $this->assertFieldByXPath('//table/tbody/tr[2]/td[1]', 'one');
+    $this->assertSession()->elementTextContains('xpath', '//table/tbody/tr[2]/td[1]', 'one');
 
     $this->assertFieldsByValue($this->xpath("//input[@id = 'edit-name']"), 'Test name');
-    $this->assertFieldByXPath("//input[@id = 'edit-name']", 'Test name');
+    $this->assertSession()->fieldValueEquals('edit-name', 'Test name');
     $this->assertFieldsByValue($this->xpath("//select[@id = 'edit-options']"), '2');
-    $this->assertFieldByXPath("//select[@id = 'edit-options']", '2');
+    $this->assertSession()->fieldValueEquals('edit-options', '2');
 
-    $this->assertNoFieldByXPath('//notexisting');
-    $this->assertNoFieldByXPath("//input[@id = 'edit-name']", 'wrong value');
+    $this->assertSession()->elementNotExists('xpath', '//notexisting');
+    $this->assertSession()->fieldValueNotEquals('edit-name', 'wrong value');
 
     // Test that the assertion fails correctly.
     try {
-      $this->assertFieldByXPath("//input[@id = 'notexisting']");
+      $this->assertSession()->fieldExists('notexisting');
       $this->fail('The "notexisting" field was found.');
     }
-    catch (ExpectationFailedException $e) {
+    catch (ExpectationException $e) {
       // Expected exception; just continue testing.
     }
 
     try {
-      $this->assertNoFieldByXPath("//input[@id = 'edit-name']");
+      $this->assertSession()->fieldNotExists('edit-name');
       $this->fail('The "edit-name" field was not found.');
     }
     catch (ExpectationException $e) {
@@ -385,16 +385,20 @@ public function testAssertField() {
   }
 
   /**
-   * Tests legacy field asserts by id.
+   * Tests legacy field asserts by id and by Xpath.
    *
    * @group legacy
    */
   public function testAssertFieldById() {
     $this->expectDeprecation('AssertLegacyTrait::assertFieldById() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldExists() or $this->assertSession()->buttonExists() or $this->assertSession()->fieldValueEquals() instead. See https://www.drupal.org/node/3129738');
     $this->expectDeprecation('AssertLegacyTrait::assertNoFieldById() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldNotExists() or $this->assertSession()->buttonNotExists() or $this->assertSession()->fieldValueNotEquals() instead. See https://www.drupal.org/node/3129738');
+    $this->expectDeprecation('AssertLegacyTrait::assertFieldByXPath() is 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. See https://www.drupal.org/node/3129738');
+    $this->expectDeprecation('AssertLegacyTrait::assertNoFieldByXPath() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use $this->xpath() instead and assert that the result is empty. See https://www.drupal.org/node/3129738');
     $this->drupalGet('test-field-xpath');
     $this->assertFieldById('edit-save', NULL);
     $this->assertNoFieldById('invalid', NULL);
+    $this->assertFieldByXPath("//input[@id = 'edit-name']", 'Test name');
+    $this->assertNoFieldByXPath("//input[@id = 'edit-name']", 'wrong value');
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
index 6ef3a4fd8f13ed3bebb26b4290c9f22ac280cb43..e203a2770d1b54c5e0e8de802c88bd0069b52bdc 100644
--- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
@@ -129,8 +129,6 @@ public static function getSkippedDeprecations() {
       'AssertLegacyTrait::assertNoText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() or $this->assertSession()->pageTextNotContains() instead. See https://www.drupal.org/node/3129738',
       'AssertLegacyTrait::assertRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738',
       'AssertLegacyTrait::assertNoRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() instead. See https://www.drupal.org/node/3129738',
-      'AssertLegacyTrait::assertFieldByXPath() is 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. See https://www.drupal.org/node/3129738',
-      'AssertLegacyTrait::assertNoFieldByXPath() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use $this->xpath() instead and assert that the result is empty. See https://www.drupal.org/node/3129738',
       'AssertLegacyTrait::assertFieldsByValue() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use iteration over the fields yourself instead and directly check the values in the test. See https://www.drupal.org/node/3129738',
       // PHPUnit 9.
       "The \"PHPUnit\TextUI\DefaultResultPrinter\" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from \"Drupal\Tests\Listeners\HtmlOutputPrinter\".",