diff --git a/core/drupalci.yml b/core/drupalci.yml
index b539d562af31e01e6f93fce2f5df9d9572128131..b658e475b8929d10046a63d3301b5000b1447028 100644
--- a/core/drupalci.yml
+++ b/core/drupalci.yml
@@ -47,7 +47,7 @@ build:
       # Functional JavaScript tests require a concurrency of 1 because there is
       # only one instance of PhantomJS on the testbot machine.
       run_tests.javascript:
-        concurrency: 15
+        concurrency: 1
         types: 'PHPUnit-FunctionalJavascript'
         testgroups: '--all'
         suppress-deprecations: false
diff --git a/core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php b/core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php
index f4c85fc755d7054c1d9706bb9f449bfc6e607d33..bc314a573d5f79f9b1579a30c6964cf8d03bb26f 100644
--- a/core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php
+++ b/core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\action\FunctionalJavascript;
 
 use Drupal\Core\Url;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\system\Entity\Action;
 
 /**
@@ -11,7 +11,7 @@
  *
  * @group action
  */
-class ActionFormAjaxTest extends WebDriverTestBase {
+class ActionFormAjaxTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -33,15 +33,16 @@ protected function setUp() {
   public function testActionConfigurationWithAjax() {
     $url = Url::fromRoute('action.admin_add', ['action_id' => 'action_form_ajax_test']);
     $this->drupalGet($url);
+    $this->assertSession()->statusCodeEquals(200);
     $page = $this->getSession()->getPage();
 
     $id = 'test_plugin';
-    $this->assertSession()->waitForElementVisible('named', ['button', 'Edit'])->press();
-    $this->assertSession()->waitForElementVisible('css', '[name="id"]')->setValue($id);
+    $page->find('css', '[name="id"]')
+      ->setValue($id);
 
     $page->find('css', '[name="having_a_party"]')
       ->check();
-    $this->assertSession()->waitForElementVisible('css', '[name="party_time"]');
+    $this->assertSession()->waitForElement('css', '[name="party_time"]');
 
     $party_time = 'Evening';
     $page->find('css', '[name="party_time"]')
@@ -53,6 +54,7 @@ public function testActionConfigurationWithAjax() {
     $url = Url::fromRoute('entity.action.collection');
     $this->assertSession()->pageTextContains('The action has been successfully saved.');
     $this->assertSession()->addressEquals($url);
+    $this->assertSession()->statusCodeEquals(200);
 
     // Check storage.
     $instance = Action::load($id);
diff --git a/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php
index f4cd5108bf8872d73d236ab7fcefa59e85af0ef1..b4da7b0a9bee14c86f5046f1c4714c8720d54082 100644
--- a/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php
+++ b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php
@@ -11,7 +11,7 @@
 use Drupal\Core\Url;
 use Drupal\editor\Entity\Editor;
 use Drupal\filter\Entity\FilterFormat;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\simpletest\ContentTypeCreationTrait;
 use Drupal\simpletest\NodeCreationTrait;
 
@@ -20,7 +20,7 @@
  *
  * @group big_pipe
  */
-class BigPipeRegressionTest extends WebDriverTestBase {
+class BigPipeRegressionTest extends JavascriptTestBase {
 
   use CommentTestTrait;
   use ContentTypeCreationTrait;
diff --git a/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php b/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php
index e9ecc06526062b249a450183ca7bb8c7d3d252bf..b64f7c1ba2e818be6449214ddc0adf1dbb852828 100644
--- a/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php
+++ b/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php
@@ -3,14 +3,14 @@
 namespace Drupal\Tests\block\FunctionalJavascript;
 
 use Behat\Mink\Element\NodeElement;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript functionality of the block add filter.
  *
  * @group block
  */
-class BlockFilterTest extends WebDriverTestBase {
+class BlockFilterTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php
index dc9b8125ccccda21dc2cf8eaed836a08081e29cb..d8d406b44080b4e6313b4788386c7961eabfa6d1 100644
--- a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php
+++ b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php
@@ -4,7 +4,7 @@
 
 use Behat\Mink\Exception\ExpectationException;
 use Drupal\Component\Render\FormattableMarkup;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\node\Entity\Node;
 
 /**
@@ -12,7 +12,7 @@
  *
  * @group book
  */
-class BookJavascriptTest extends WebDriverTestBase {
+class BookJavascriptTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php b/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php
index ddb53d8303e888b58ab13703e19f74051cab70e4..b15433d4f757b830462e742e9cd09f5b4bc8e369 100644
--- a/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php
+++ b/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php
@@ -4,14 +4,14 @@
 
 use Drupal\editor\Entity\Editor;
 use Drupal\filter\Entity\FilterFormat;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests delivery of CSS to CKEditor via AJAX.
  *
  * @group ckeditor
  */
-class AjaxCssTest extends WebDriverTestBase {
+class AjaxCssTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php b/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
index a9ee69719b54a0f046062e81c6a9902a3d38b63e..80de46d6bc425a146907ef74362d7bd5cd96fc7d 100644
--- a/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
+++ b/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
@@ -7,7 +7,7 @@
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\filter\Entity\FilterFormat;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\node\Entity\NodeType;
 
 /**
@@ -15,7 +15,7 @@
  *
  * @group ckeditor
  */
-class CKEditorIntegrationTest extends WebDriverTestBase {
+class CKEditorIntegrationTest extends JavascriptTestBase {
 
   /**
    * The account.
@@ -92,10 +92,9 @@ public function testFragmentLink() {
     $session->getPage();
 
     // Add a bottom margin to the title field to be sure the body field is not
-    // visible.
-    $session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = window.innerHeight*2 +'px';");
+    // visible. PhantomJS runs with a resolution of 1024x768px.
+    $session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = '800px';");
 
-    $this->assertSession()->waitForElementVisible('css', $ckeditor_id);
     // Check that the CKEditor-enabled body field is currently not visible in
     // the viewport.
     $web_assert->assertNotVisibleInViewport('css', $ckeditor_id, 'topLeft', 'CKEditor-enabled body field is visible.');
diff --git a/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php b/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php
index f7e6dc8ff528caec5927a5cfe67f810809a06325..110c9f894eaf539051a0c35398d7e349d01d156e 100644
--- a/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php
+++ b/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\config\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the Config operations through the UI.
  *
  * @group config
  */
-class ConfigEntityTest extends WebDriverTestBase {
+class ConfigEntityTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php
index 585d2d1d38d046cece76ad16237a53445f0a352f..13e1b545c2b6c8bcc8a6940c34e775f2ba360bee 100644
--- a/core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\config_translation\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Translate settings and entities to various languages.
  *
  * @group config_translation
  */
-class ConfigTranslationUiTest extends WebDriverTestBase {
+class ConfigTranslationUiTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php
index 156b10d97ff91c5a37b8f66703aa576ffcae8bcf..b0953991954d507ad6fb06363831b5cd961450ab 100644
--- a/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php
+++ b/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\content_translation\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
 
 /**
@@ -10,7 +10,7 @@
  *
  * @group content_translation
  */
-class ContentTranslationContextualLinksTest extends WebDriverTestBase {
+class ContentTranslationContextualLinksTest extends JavascriptTestBase {
 
   /**
    * The 'translator' user to use during testing.
diff --git a/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php b/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php
index 7435dada23f3810456a3bb1e8988f6f9457ac873..de836924119fe900cbdf6b41a44b72f0dd41df73 100644
--- a/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php
+++ b/core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\contextual\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\user\Entity\Role;
 
 /**
@@ -10,7 +10,7 @@
  *
  * @group contextual
  */
-class ContextualLinksTest extends WebDriverTestBase {
+class ContextualLinksTest extends JavascriptTestBase {
 
   use ContextualLinkClickTrait;
 
diff --git a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php
index 4a00a7efc491c931eb4a4702d42384dc76666a71..a61ea8a3d788e87338bc0eac7d3a9e6f007446cd 100644
--- a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php
+++ b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\contextual\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests edit mode.
  *
  * @group contextual
  */
-class EditModeTest extends WebDriverTestBase {
+class EditModeTest extends JavascriptTestBase {
 
   /**
    * CSS selector for Drupal's announce element.
diff --git a/core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php b/core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php
index 0561d73711999d99c5ead776ea40bdad0dbd0667..64ee24d46941ffb1c24a83c9ff43497bfe927263 100644
--- a/core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php
+++ b/core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php
@@ -6,14 +6,14 @@
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests add more behavior for a multiple value field.
  *
  * @group field
  */
-class FormJSAddMoreTest extends WebDriverTestBase {
+class FormJSAddMoreTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php b/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php
index 9e65b270be7d745b8c81ae708ea1103f95a53a36..162d22329c422c904f9fbefd31bfdc131157aca7 100644
--- a/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php
+++ b/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php
@@ -3,14 +3,14 @@
 namespace Drupal\Tests\field_layout\FunctionalJavascript;
 
 use Drupal\entity_test\Entity\EntityTest;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests using field layout for entity displays.
  *
  * @group field_layout
  */
-class FieldLayoutTest extends WebDriverTestBase {
+class FieldLayoutTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -100,15 +100,12 @@ public function testEntityForm() {
     // After a refresh the new regions are still there.
     $this->drupalGet('entity_test/structure/entity_test/form-display');
     $this->assertEquals(['Top', 'First', 'Second', 'Bottom', 'Disabled'], $this->getRegionTitles());
-    $this->assertSession()->waitForElement('css', '.tabledrag-handle');
-    $id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
 
     // Drag the field to the second region.
     $field_test_text_row = $this->getSession()->getPage()->find('css', '#field-test-text');
     $second_region_row = $this->getSession()->getPage()->find('css', '.region-second-message');
     $field_test_text_row->find('css', '.handle')->dragTo($second_region_row);
     $this->assertSession()->assertWaitOnAjaxRequest();
-    $this->assertSession()->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
     $this->submitForm([], 'Save');
     $this->assertSession()->pageTextContains('Your settings have been saved.');
 
@@ -161,8 +158,6 @@ public function testEntityView() {
     // After a refresh the new regions are still there.
     $this->drupalGet('entity_test/structure/entity_test/display');
     $this->assertEquals(['Top', 'First', 'Second', 'Bottom', 'Disabled'], $this->getRegionTitles());
-    $this->assertSession()->waitForElement('css', '.tabledrag-handle');
-    $id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
 
     // Drag the field to the first region.
     $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
@@ -171,7 +166,6 @@ public function testEntityView() {
     $field_test_text_row->find('css', '.handle')->dragTo($first_region_row);
     $this->assertSession()->assertWaitOnAjaxRequest();
     $this->assertFalse($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
-    $this->assertSession()->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
     $this->submitForm([], 'Save');
     $this->assertSession()->pageTextContains('Your settings have been saved.');
 
diff --git a/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php b/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
index 7909f0f0061c61d32fd07976822d7efe657d355d..ae2c56c954b79c6e6d93ebee2127201378f99bfa 100644
--- a/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
@@ -3,14 +3,14 @@
 namespace Drupal\Tests\field_ui\FunctionalJavascript;
 
 use Drupal\entity_test\Entity\EntityTest;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the UI for entity displays.
  *
  * @group field_ui
  */
-class EntityDisplayTest extends WebDriverTestBase {
+class EntityDisplayTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -50,8 +50,7 @@ public function testEntityForm() {
 
     $this->drupalGet('entity_test/structure/entity_test/form-display');
     $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());
-    $this->getSession()->getPage()->pressButton('Show row weights');
-    $this->assertSession()->waitForElementVisible('css', '[name="fields[field_test_text][region]"]');
+
     $this->getSession()->getPage()->selectFieldOption('fields[field_test_text][region]', 'hidden');
     $this->assertSession()->assertWaitOnAjaxRequest();
     $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
@@ -73,8 +72,6 @@ public function testEntityView() {
 
     $this->drupalGet('entity_test/structure/entity_test/display');
     $this->assertSession()->elementExists('css', '.region-content-message.region-empty');
-    $this->getSession()->getPage()->pressButton('Show row weights');
-    $this->assertSession()->waitForElementVisible('css', '[name="fields[field_test_text][region]"]');
     $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
 
     $this->getSession()->getPage()->selectFieldOption('fields[field_test_text][region]', 'content');
@@ -95,16 +92,12 @@ public function testEntityView() {
   public function testExtraFields() {
     entity_test_create_bundle('bundle_with_extra_fields');
     $this->drupalGet('entity_test/structure/bundle_with_extra_fields/display');
-    $this->assertSession()->waitForElement('css', '.tabledrag-handle');
-    $id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
 
     $extra_field_row = $this->getSession()->getPage()->find('css', '#display-extra-field');
     $disabled_region_row = $this->getSession()->getPage()->find('css', '.region-hidden-title');
 
     $extra_field_row->find('css', '.handle')->dragTo($disabled_region_row);
     $this->assertSession()->assertWaitOnAjaxRequest();
-    $this->assertSession()
-      ->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
 
     $this->submitForm([], 'Save');
     $this->assertSession()->pageTextContains('Your settings have been saved.');
diff --git a/core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php b/core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php
index 99acc3712a01d7301a519e70ed7f57c49716823b..2e4cb697595f6ae32ef738c959e99377eb8c317e 100644
--- a/core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php
+++ b/core/modules/file/tests/src/FunctionalJavascript/FileFieldValidateTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\file\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\Tests\file\Functional\FileFieldCreationTrait;
 use Drupal\Tests\TestFileCreationTrait;
 
@@ -12,7 +12,7 @@
  *
  * @group file
  */
-class FileFieldValidateTest extends WebDriverTestBase {
+class FileFieldValidateTest extends JavascriptTestBase {
 
   use FileFieldCreationTrait;
   use TestFileCreationTrait;
diff --git a/core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php b/core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php
index 45c8bf5eec0871051498de5c4186c6a17e4e9dd8..7ccd2b218737f8f3582301bf91e1f36d6aa3b4ec 100644
--- a/core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php
+++ b/core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\file\FunctionalJavascript;
 
 use Drupal\Component\Utility\Bytes;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\Tests\TestFileCreationTrait;
 use Drupal\Tests\file\Functional\FileFieldCreationTrait;
 
@@ -12,7 +12,7 @@
  *
  * @group file
  */
-class MaximumFileSizeExceededUploadTest extends WebDriverTestBase {
+class MaximumFileSizeExceededUploadTest extends JavascriptTestBase {
 
   use FileFieldCreationTrait;
   use TestFileCreationTrait;
diff --git a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
index 4e21f6aca7a24e1dbf56e13da05186d8ea16a41a..a4af78b9a3eb3dedf0a4264328bd1b6b428f6f2d 100644
--- a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
+++ b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
@@ -2,14 +2,15 @@
 
 namespace Drupal\Tests\image\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\Tests\image\Kernel\ImageFieldCreationTrait;
 use Drupal\Tests\TestFileCreationTrait;
 
 /**
  * This class provides methods specifically for testing Image's field handling.
  */
-abstract class ImageFieldTestBase extends WebDriverTestBase {
+abstract class ImageFieldTestBase extends JavascriptTestBase {
 
   use ImageFieldCreationTrait;
   use TestFileCreationTrait {
@@ -28,6 +29,11 @@ abstract class ImageFieldTestBase extends WebDriverTestBase {
     'image_module_test',
   ];
 
+  /**
+   * {@inheritdoc}
+   */
+  protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
+
   /**
    * An user with permissions to administer content types and image styles.
    *
diff --git a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php
index 7c9a74ab503488f95d5255c3e308dc554ea255f3..2007e1e266329d7b467421672b61460d05e74ce0 100644
--- a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php
+++ b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php
@@ -7,7 +7,7 @@
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\filter\Entity\FilterFormat;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\node\Entity\NodeType;
 
 /**
@@ -15,7 +15,7 @@
  *
  * @group ckeditor
  */
-class FormErrorHandlerCKEditorTest extends WebDriverTestBase {
+class FormErrorHandlerCKEditorTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -87,10 +87,9 @@ public function testFragmentLink() {
 
     $this->submitForm($edit, 'Save');
 
-    $this->assertSession()->waitForElement('css', '#cke_edit-body-0-value');
     // Add a bottom margin to the title field to be sure the body field is not
-    // visible.
-    $session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = window.innerHeight*2 + 'px';");
+    // visible. PhantomJS runs with a resolution of 1024x768px.
+    $session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = '800px';");
 
     // Check that the CKEditor-enabled body field is currently not visible in
     // the viewport.
diff --git a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php
index 00dc3d3f622360c2fdb181cef35ce018ea1bd6b4..b956cccbd0bdb0b527bf6ad0806a5f13648dac90 100644
--- a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php
+++ b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerQuickEditTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\inline_form_errors\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\node\Entity\NodeType;
 
 /**
@@ -10,7 +10,7 @@
  *
  * @group inline_form_errors
  */
-class FormErrorHandlerQuickEditTest extends WebDriverTestBase {
+class FormErrorHandlerQuickEditTest extends JavascriptTestBase {
 
   /**
    * Modules to enable.
diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php
index f2ecd52b3bf47bdc853fd32f67f4f0ee9fa57846..4f086d6a96b966a793a1ca4211b700e15f8fe2f2 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php
@@ -4,14 +4,14 @@
 
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * @coversDefaultClass \Drupal\layout_builder\Plugin\Block\FieldBlock
  *
  * @group field
  */
-class FieldBlockTest extends WebDriverTestBase {
+class FieldBlockTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
index 76b1badd0b3ed7edc2748ea50e409bca8a499df6..30b62042c8271ee61656903c3ac092a5caf05ac3 100644
--- a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
+++ b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
@@ -55,7 +55,6 @@ public function testMediaDisplay() {
     // Enable the field on the display and verify it becomes visible on the UI.
     $this->drupalGet("/admin/structure/media/manage/{$media_type->id()}/display");
     $assert_session->buttonExists('Show row weights')->press();
-    $this->assertSession()->waitForElementVisible('css', '[name="fields[name][region]"]');
     $page->selectFieldOption('fields[name][region]', 'content');
     $assert_session->waitForElementVisible('css', '#edit-fields-name-settings-edit');
     $page->pressButton('Save');
diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php b/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php
index f8c04d17b6e3ff05144785adc251c51da9241018..e84db38b7ddb39734e7a2e3348e16cf33395e2bd 100644
--- a/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php
+++ b/core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\media\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\Tests\media\Functional\MediaFunctionalTestTrait;
 use Drupal\Tests\media\Traits\MediaTypeCreationTrait;
 
 /**
  * Base class for Media functional JavaScript tests.
  */
-abstract class MediaJavascriptTestBase extends WebDriverTestBase {
+abstract class MediaJavascriptTestBase extends JavascriptTestBase {
 
   use MediaFunctionalTestTrait;
   use MediaTypeCreationTrait;
diff --git a/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
index 154a1d230253bb6a5427e36c2bc67b91504f9a63..f8604e644bf997c07622f319fd7e1392f609a1ab 100644
--- a/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
+++ b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\media_library\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\media\Entity\Media;
 
 /**
@@ -10,7 +10,7 @@
  *
  * @group media_library
  */
-class MediaLibraryTest extends WebDriverTestBase {
+class MediaLibraryTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php b/core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php
index 22959326dca9ca31cfc52fad2caf428b3bf7e5d2..6ce4ccc713d64bca1c22c9f3bb717c120d37250f 100644
--- a/core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php
+++ b/core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\menu_ui\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\system\Entity\Menu;
 use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
 use Drupal\Tests\menu_ui\Traits\MenuUiTrait;
@@ -12,7 +12,7 @@
  *
  * @group menu_ui
  */
-class MenuUiJavascriptTest extends WebDriverTestBase {
+class MenuUiJavascriptTest extends JavascriptTestBase {
 
   use ContextualLinkClickTrait;
   use MenuUiTrait;
@@ -123,6 +123,7 @@ protected function addCustomMenu() {
   protected function addMenuLink($parent = '', $path = '/', $menu_id = 'tools', $expanded = FALSE, $weight = '0') {
     // View add menu link page.
     $this->drupalGet("admin/structure/menu/manage/$menu_id/add");
+    $this->assertSession()->statusCodeEquals(200);
 
     $title = '!link_' . $this->randomMachineName(16);
     $edit = [
@@ -137,6 +138,7 @@ protected function addMenuLink($parent = '', $path = '/', $menu_id = 'tools', $e
 
     // Add menu link.
     $this->drupalPostForm(NULL, $edit, 'Save');
+    $this->assertSession()->statusCodeEquals(200);
     $this->assertSession()->pageTextContains('The menu link has been saved.');
 
     $storage = $this->container->get('entity_type.manager')->getStorage('menu_link_content');
diff --git a/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
index e1c185000f9539d2e72e2f461c3d7f605eade53a..8eb7a268d0ad3d71b93746c832f18fe1648d5fba 100644
--- a/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
+++ b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
@@ -3,14 +3,14 @@
 namespace Drupal\Tests\node\FunctionalJavascript;
 
 use Drupal\filter\Entity\FilterFormat;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript prevention of navigation away from node previews.
  *
  * @group node
  */
-class NodePreviewLinkTest extends WebDriverTestBase {
+class NodePreviewLinkTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
index aef0c1e27d344bc94bf0b9b4e4cbc6c82a411e53..4760ee65091137379126e57132e5c0b6ecbf2172 100644
--- a/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
+++ b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\node\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript updating of summaries on content type form.
  *
  * @group node
  */
-class TestSettingSummariesContentType extends WebDriverTestBase {
+class TestSettingSummariesContentType extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -33,8 +33,6 @@ public function setUp() {
   public function testWorkflowSummary() {
     $this->drupalGet('admin/structure/types/manage/test');
     $page = $this->getSession()->getPage();
-    $page->find('css', 'a[href="#edit-workflow"]')->click();
-    $this->assertSession()->waitForElementVisible('css', '[name="options[status]"]');
     $page->findField('options[status]')->uncheck();
     $page->findField('options[sticky]')->check();
     $page->findField('options[promote]')->check();
diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php
index 7555220acfbebb1b35e37716605822d60cade882..3e604700dfd888663c228ead7065f9ca83184c73 100644
--- a/core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php
+++ b/core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php
@@ -4,7 +4,7 @@
 
 use Drupal\editor\Entity\Editor;
 use Drupal\filter\Entity\FilterFormat;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\node\Entity\Node;
 use Drupal\node\Entity\NodeType;
 use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
@@ -14,7 +14,7 @@
  *
  * @group quickedit
  */
-class FieldTest extends WebDriverTestBase {
+class FieldTest extends JavascriptTestBase {
 
   use ContextualLinkClickTrait;
 
diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php
index 8c939b3264a125ec292190657ce6b3a2a60f3c1d..cb40a83cecaec7f20c08b8e85820b2294abea7e1 100644
--- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php
+++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php
@@ -2,13 +2,21 @@
 
 namespace Drupal\Tests\quickedit\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use WebDriver\Key;
 
 /**
  * Base class for testing the QuickEdit.
  */
-class QuickEditJavascriptTestBase extends WebDriverTestBase {
+class QuickEditJavascriptTestBase extends JavascriptTestBase {
+
+  /**
+   * {@inheritdoc}
+   *
+   * @todo: Remove after https://www.drupal.org/project/drupal/issues/2942900
+   */
+  protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php
index 6b15be9425ebda1e6e5373c39ecc2d4307a73b27..8646b93ec38bc3d341004bfd38c2b5cb9aa78fb9 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php
@@ -51,7 +51,6 @@ public function testBlockConfigAccess() {
     // permission.
     $web_assert->fieldNotExists('settings[site_information][site_name]');
     $page->pressButton('Save Site branding');
-    $this->waitForOffCanvasToClose();
     $this->assertElementVisibleAfterWait('css', 'div:contains(The block configuration has been saved)');
     $web_assert->assertWaitOnAjaxRequest();
     // Confirm we did not save changes to the configuration.
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
index 6f623cb1bcf10dd5d7f96140931c22cb7f5cb2ea..d30562f71d665a4a5e114b7b23038451f3b44c7f 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
@@ -134,8 +134,6 @@ public function testCustomBlockLinks() {
     $this->placeBlock('block_content:' . $block_content->uuid(), ['id' => 'custom']);
     $this->drupalGet('user');
     $page = $this->getSession()->getPage();
-    $this->toggleContextualTriggerVisibility('#block-custom');
-    $page->find('css', '#block-custom .contextual button')->press();
     $links = $page->findAll('css', "#block-custom .contextual-links li a");
     $link_labels = [];
     /** @var \Behat\Mink\Element\NodeElement $link */
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
index 0e6b9d6251e0372d5d481b2cad03c97c39018bf4..106dae43e11547a47a186824cd3d03356af5f34c 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
@@ -67,8 +67,8 @@ protected function doTestBlocks($theme, $block_plugin, $new_page_text, $element_
     $block_id = $block->id();
     $this->drupalGet('user');
 
-    $link = $web_assert->waitForElement('css', "$block_selector .contextual-links li a");
-    $this->assertEquals('Quick edit', $link->getHtml(), "'Quick edit' is the first contextual link for the block.");
+    $link = $page->find('css', "$block_selector .contextual-links li a");
+    $this->assertEquals('Quick edit', $link->getText(), "'Quick edit' is the first contextual link for the block.");
     $this->assertContains("/admin/structure/block/manage/$block_id/settings-tray?destination=user/2", $link->getAttribute('href'));
 
     if (isset($toolbar_item)) {
@@ -138,11 +138,9 @@ protected function doTestBlocks($theme, $block_plugin, $new_page_text, $element_
     $this->getSession()->executeScript('jQuery("body").trigger(jQuery.Event("keyup", { keyCode: 27 }));');
     $this->waitForOffCanvasToClose();
     $this->getSession()->wait(100);
-    $this->getSession()->executeScript("jQuery('[data-quickedit-entity-id]').trigger('mouseleave')");
-    $this->getSession()->getPage()->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR)->mouseOver();
     $this->assertEditModeDisabled();
-    $this->assertNotEmpty($web_assert->waitForElement('css', '#drupal-live-announce:contains(Exited edit mode)'));
-    $this->waitForNoElement('.contextual-toolbar-tab button:contains(Editing)');
+    $web_assert->elementTextContains('css', '#drupal-live-announce', 'Exited edit mode.');
+    $web_assert->elementTextNotContains('css', '.contextual-toolbar-tab button', 'Editing');
     $web_assert->elementAttributeNotContains('css', '.dialog-off-canvas-main-canvas', 'class', 'js-settings-tray-edit-mode');
 
     // Clean up test data so each test does not impact the next.
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
index 2017accd88aa786262ad63ec79041a2a562fa54a..448fd21836f3cf808db0fff11ad0a1b6c262918a 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
@@ -49,9 +49,7 @@ protected function openBlockForm($block_selector, $contextual_link_container = '
     $this->assertElementVisibleAfterWait('css', '.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode');
     // Ensure that all other Ajax activity is completed.
     $this->assertSession()->assertWaitOnAjaxRequest();
-    $block = $this->getSession()->getPage()->find('css', $block_selector);
-    $block->mouseOver();
-    $block->click();
+    $this->click($block_selector);
     $this->waitForOffCanvasToOpen();
     $this->assertOffCanvasBlockFormIsValid();
   }
@@ -81,8 +79,6 @@ protected function pressToolbarEditButton() {
     $edit_button = $this->getSession()
       ->getPage()
       ->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR);
-    $this->getSession()->executeScript("jQuery('[data-quickedit-entity-id]').trigger('mouseleave')");
-    $edit_button->mouseOver();
     $edit_button->press();
   }
 
@@ -91,12 +87,6 @@ protected function pressToolbarEditButton() {
    */
   protected function assertEditModeDisabled() {
     $web_assert = $this->assertSession();
-    $page = $this->getSession()->getPage();
-    $this->getSession()->executeScript("jQuery('[data-quickedit-entity-id]').trigger('mouseleave')");
-    $page->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR)->mouseOver();
-    $this->assertTrue($page->waitFor(10, function ($page) {
-      return !$page->find('css', '.contextual .trigger:not(.visually-hidden)');
-    }));
     // Contextual triggers should be hidden.
     $web_assert->elementExists('css', '.contextual .trigger.visually-hidden');
     // No contextual triggers should be not hidden.
@@ -113,13 +103,6 @@ protected function assertEditModeDisabled() {
    */
   protected function assertEditModeEnabled() {
     $web_assert = $this->assertSession();
-    $page = $this->getSession()->getPage();
-    // Move the mouse over the toolbar button so that isn't over a contextual
-    // links area which cause the contextual link to be shown.
-    $page->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR)->mouseOver();
-    $this->assertTrue($page->waitFor(10, function ($page) {
-      return !$page->find('css', '.contextual .trigger.visually-hidden');
-    }));
     // No contextual triggers should be hidden.
     $web_assert->elementNotExists('css', '.contextual .trigger.visually-hidden');
     // The toolbar edit button should read "Editing".
diff --git a/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php b/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php
index 945afe95f83ee5a771e9e64ce2d5c0eeb2b3d8c0..24397990e041e81ce137ed2664bede06732f9db1 100644
--- a/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php
+++ b/core/modules/simpletest/tests/src/FunctionalJavascript/BrowserWithJavascriptTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\simpletest\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests if we can execute JavaScript in the browser.
  *
  * @group javascript
  */
-class BrowserWithJavascriptTest extends WebDriverTestBase {
+class BrowserWithJavascriptTest extends JavascriptTestBase {
 
   public function testJavascript() {
     $this->drupalGet('<front>');
diff --git a/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php b/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php
index fbe9b737926fc33e8c7bd7d5a82385741a2a3830..0048159bfa8af8d6d34ce557d898321542c0be6b 100644
--- a/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php
+++ b/core/modules/simpletest/tests/src/FunctionalJavascript/JavascriptGetDrupalSettingsTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\simpletest\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests Drupal settings retrieval in JavascriptTestBase tests.
  *
  * @group javascript
  */
-class JavascriptGetDrupalSettingsTest extends WebDriverTestBase {
+class JavascriptGetDrupalSettingsTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -19,7 +19,7 @@ class JavascriptGetDrupalSettingsTest extends WebDriverTestBase {
   /**
    * Tests retrieval of Drupal settings.
    *
-   * @see \Drupal\FunctionalJavascriptTests\WebDriverTestBase::getDrupalSettings()
+   * @see \Drupal\FunctionalJavascriptTests\JavascriptTestBase::getDrupalSettings()
    */
   public function testGetDrupalSettings() {
     $this->drupalLogin($this->drupalCreateUser());
diff --git a/core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php b/core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php
index acd103e9f69d47b72cd29427fba85b4310603773..b00f0ed47dfbea0217cb7a6b5b4d2cc8ef9180cb 100644
--- a/core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php
+++ b/core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\statistics\FunctionalJavascript;
 
 use Drupal\Core\Session\AccountInterface;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\user\Entity\Role;
 
@@ -12,7 +12,7 @@
  *
  * @group system
  */
-class StatisticsLoggingTest extends WebDriverTestBase {
+class StatisticsLoggingTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php b/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php
index 3597ba46dd2e07ae9429693e1642b78d43141d9a..7c0aec022cb61f9534383190fc279736fd19071a 100644
--- a/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php
+++ b/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\system\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests that dialog links use different renderer services.
  *
  * @group system
  */
-class ModalRendererTest extends WebDriverTestBase {
+class ModalRendererTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php
index c42d777c135eee2bed76ad7b25230752aa25ae9c..7719634118c45d83a6db3260f6c3f8a56772dc5e 100644
--- a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php
+++ b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php
@@ -50,7 +50,7 @@ public function testOffCanvasLinks($theme) {
       if ($link_index == '2') {
         // Check no title behavior.
         $web_assert->elementExists('css', '.ui-dialog-empty-title');
-        $this->assertEquals(' ', $header_text);
+        $this->assertEquals("\xc2\xa0", $header_text);
 
         $style = $page->find('css', '.ui-dialog-off-canvas')->getAttribute('style');
         $this->assertTrue(strstr($style, 'width: 555px;') !== FALSE, 'Dialog width respected.');
@@ -127,9 +127,6 @@ public function testNarrowWidth() {
       $this->waitForOffCanvasToOpen();
       // Check that the main canvas is padded when page is not narrow width and
       // tray is open.
-      $page->waitFor(10, function ($page) {
-        return $page->find('css', '.dialog-off-canvas-main-canvas')->hasAttribute('style');
-      });
       $web_assert->elementAttributeContains('css', '.dialog-off-canvas-main-canvas', 'style', 'padding-right');
 
       // Testing at the narrower width.
diff --git a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php
index b2e6c2b65d8441aa2c9878197d0b566673599d9d..293d9f70a04d5fec9244169ec66483a43d8c14b0 100644
--- a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php
+++ b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php
@@ -2,12 +2,12 @@
 
 namespace Drupal\Tests\system\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Base class contains common test functionality for the Off-canvas dialog.
  */
-abstract class OffCanvasTestBase extends WebDriverTestBase {
+abstract class OffCanvasTestBase extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -106,22 +106,8 @@ protected function getOffCanvasDialog() {
    * @todo Remove in https://www.drupal.org/node/2892440.
    */
   protected function waitForNoElement($selector, $timeout = 10000) {
-
-    $start = microtime(TRUE);
-    $end = $start + ($timeout / 1000);
-    $page = $this->getSession()->getPage();
-
-    do {
-      $result = $page->find('css', $selector);
-
-      if (empty($result)) {
-        return;
-      }
-
-      usleep(100000);
-    } while (microtime(TRUE) < $end);
-
-    $this->assertEmpty($result, 'Element was not on the page after wait.');
+    $condition = "(typeof jQuery !== 'undefined' && jQuery('$selector').length === 0)";
+    $this->assertJsCondition($condition, $timeout);
   }
 
   /**
@@ -146,7 +132,6 @@ protected function getTestThemes() {
    *   (Optional) Timeout in milliseconds, defaults to 10000.
    */
   protected function assertElementVisibleAfterWait($selector, $locator, $timeout = 10000) {
-    $this->assertSession()->assertWaitOnAjaxRequest();
     $this->assertNotEmpty($this->assertSession()->waitForElementVisible($selector, $locator, $timeout));
   }
 
diff --git a/core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php b/core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php
index 4f3e9f1d49cbb5233acf95399c7be38ad2fd11ee..8e4729fe332a3d705067f44be1fe6e2f39d69a8b 100644
--- a/core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php
+++ b/core/modules/system/tests/src/FunctionalJavascript/ThemeFormSettingsTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\system\FunctionalJavascript;
 
 use Drupal\file\Entity\File;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\Tests\TestFileCreationTrait;
 
 /**
@@ -11,7 +11,7 @@
  *
  * @group system
  */
-class ThemeFormSettingsTest extends WebDriverTestBase {
+class ThemeFormSettingsTest extends JavascriptTestBase {
 
   use TestFileCreationTrait;
 
diff --git a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
index 88153abce5b43787694b5352d99e8b3fb8fb90bd..76fbcc77d7495e718b438e45c63ba9e642d20b9c 100644
--- a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
+++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
@@ -3,14 +3,14 @@
 namespace Drupal\Tests\text\FunctionalJavascript;
 
 use Drupal\field\Entity\FieldConfig;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript functionality of the text_textarea_with_summary widget.
  *
  * @group text
  */
-class TextareaWithSummaryTest extends WebDriverTestBase {
+class TextareaWithSummaryTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
index fd163985e75068ffcde1865bae949ea11d8bccd4..c3b3d9abc60939d46374c4ad17a83ff56eea758e 100644
--- a/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
+++ b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\toolbar\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript functionality of the toolbar.
  *
  * @group toolbar
  */
-class ToolbarIntegrationTest extends WebDriverTestBase {
+class ToolbarIntegrationTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -27,12 +27,7 @@ public function testToolbarToggling() {
     ]);
     $this->drupalLogin($admin_user);
 
-    // Set size for horizontal toolbar.
-    $this->getSession()->resizeWindow(1200, 600);
     $this->drupalGet('<front>');
-    $this->assertNotEmpty($this->assertSession()->waitForElement('css', 'body.toolbar-horizontal'));
-    $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '.toolbar-tray'));
-
     $page = $this->getSession()->getPage();
 
     // Test that it is possible to toggle the toolbar tray.
diff --git a/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php
index 085fd821d527f52df4c89a55dcd2b34307c4f625..0e5095d81aeb604b42f6c1d8b8ee120f78ff40c4 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\simpletest\ContentTypeCreationTrait;
 use Drupal\simpletest\NodeCreationTrait;
 use Drupal\views\Tests\ViewTestData;
@@ -12,7 +12,7 @@
  *
  * @group views
  */
-class ClickSortingAJAXTest extends WebDriverTestBase {
+class ClickSortingAJAXTest extends JavascriptTestBase {
 
   use ContentTypeCreationTrait;
   use NodeCreationTrait;
diff --git a/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php
index 6aa52bcd12c1b4dd79a8dd00484ac5fade916120..dc6846876b6181cc31ea153f6db4f9767ae5a0fc 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\simpletest\ContentTypeCreationTrait;
 use Drupal\simpletest\NodeCreationTrait;
 
@@ -11,7 +11,7 @@
  *
  * @group views
  */
-class ExposedFilterAJAXTest extends WebDriverTestBase {
+class ExposedFilterAJAXTest extends JavascriptTestBase {
 
   use ContentTypeCreationTrait;
   use NodeCreationTrait;
diff --git a/core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php b/core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php
index d4760e59b41babb67642ae3f8fd38b75a211ec93..594d6f764bb2e6bb10b17b816461e449590fe360 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\views\FunctionalJavascript;
 
 use Drupal\Core\Url;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\simpletest\ContentTypeCreationTrait;
 use Drupal\simpletest\NodeCreationTrait;
@@ -14,7 +14,7 @@
  *
  * @group node
  */
-class GlossaryViewTest extends WebDriverTestBase {
+class GlossaryViewTest extends JavascriptTestBase {
 
   use ContentTypeCreationTrait;
   use NodeCreationTrait;
diff --git a/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php
index de4efd24abdffda4b905f9c7d63a3ead5fb9df64..b4372c6d61bd9f5c89d70b8a0cee6c2288601fd9 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\simpletest\ContentTypeCreationTrait;
 use Drupal\simpletest\NodeCreationTrait;
 use Drupal\views\Tests\ViewTestData;
@@ -12,7 +12,7 @@
  *
  * @group views
  */
-class PaginationAJAXTest extends WebDriverTestBase {
+class PaginationAJAXTest extends JavascriptTestBase {
 
   use ContentTypeCreationTrait;
   use NodeCreationTrait;
diff --git a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php
index f0ac6085487c076ee1d5e45ff7f08a1b5a928678..dd1d1ae26480b40001d6c2df96dd9a9e13e4b188 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/ContextualFilterTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\views\Tests\ViewTestData;
 
 /**
@@ -10,7 +10,7 @@
  *
  * @group views
  */
-class ContextualFilterTest extends WebDriverTestBase {
+class ContextualFilterTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php
index 079fe99ee4af000269e8016acb21f2a5aef92d78..76f0ff1e2145bb78ff666b48238057b0ee0ebb51 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php
@@ -4,7 +4,7 @@
 
 use Drupal\Tests\SchemaCheckTestTrait;
 use Drupal\field\Entity\FieldConfig;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\node\Entity\NodeType;
 use Drupal\views\Tests\ViewTestData;
 
@@ -13,7 +13,7 @@
  *
  * @group views
  */
-class FieldTest extends WebDriverTestBase {
+class FieldTest extends JavascriptTestBase {
   use SchemaCheckTestTrait;
 
   /**
diff --git a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php
index 1bc8a486d32e4ddd77acb5cb2bc5d8c4a7e6052f..9a9b2da4a8d154f36096ea0e9c6c2f46544f0304 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler;
 
 use Drupal\field\Entity\FieldConfig;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\node\Entity\NodeType;
 use Drupal\views\Tests\ViewTestData;
 
@@ -12,7 +12,7 @@
  *
  * @group views
  */
-class GroupedExposedFilterTest extends WebDriverTestBase {
+class GroupedExposedFilterTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php
index 7dcaccdd241ada9fec90b7c285af28e68edcf8f6..c8d37f21c3cae180ee91c1b086698ec317dd91c8 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views_ui\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\simpletest\NodeCreationTrait;
 use Drupal\views\Entity\View;
 use Drupal\views\Tests\ViewTestData;
@@ -12,7 +12,7 @@
  *
  * @group views_ui
  */
-class DisplayTest extends WebDriverTestBase {
+class DisplayTest extends JavascriptTestBase {
 
   use NodeCreationTrait;
 
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
index 9e303dfb9222cf989ae956a3ff9843c4feb33f34..e48487a6ed61f979a5d3c6fdfa58d68fcbb2419a 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\views_ui\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the View UI filter criteria group dialog.
  *
  * @group views_ui
  */
-class FilterCriteriaTest extends WebDriverTestBase {
+class FilterCriteriaTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php
index 6f2f6259682d1f05dce940f528864cdc9afb5815..32b1a400cb7b9fcc3aecd14343f07163f3e081bb 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\views_ui\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript filtering of options in add handler form.
  *
  * @group views_ui
  */
-class FilterOptionsTest extends WebDriverTestBase {
+class FilterOptionsTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
index b1b158ba6ce30b4f1b3567e07994651921b6acee..4cf51d57fa359a4437f7307c599159b2ad3005a5 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\Tests\views_ui\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript library caching on consecutive requests.
  *
  * @group views_ui
  */
-class LibraryCachingTest extends WebDriverTestBase {
+class LibraryCachingTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
index fc696c03a866ff0097613063b1fe7280f33ddf0d..86d3b6e5e7e4811627f20c8054d6ec6b9d32ff52 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views_ui\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript filtering on the Views listing page.
@@ -10,7 +10,7 @@
  * @see core/modules/views_ui/js/views_ui.listing.js
  * @group views_ui
  */
-class ViewsListingTest extends WebDriverTestBase {
+class ViewsListingTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php
index 16369f12fea1ce1804003ab5a9f5fbdeda93b911..3fb1167e1f3bbabed204a162ca944467d1d4d55b 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views_ui\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests views creation wizard.
@@ -10,7 +10,7 @@
  * @see core/modules/views_ui/js/views-admin.js
  * @group views_ui
  */
-class ViewsWizardTest extends WebDriverTestBase {
+class ViewsWizardTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php
index 13973e0c5dc032b2295acd3b25eab626baa6f059..c9c92f404f2b72bab3c3fb82cbf055f2da55a8db 100644
--- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php
+++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\standard\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\node\Entity\Node;
 
 /**
@@ -10,7 +10,7 @@
  *
  * @group standard
  */
-class StandardJavascriptTest extends WebDriverTestBase {
+class StandardJavascriptTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
index ffdbd98eb91dc1eafb45a547c6d8d9dc19f28577..e13ecfd56c6bc1474b6514fc4eea2f04d444aa57 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\FunctionalJavascriptTests\Ajax;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests Ajax callbacks on FAPI elements.
  *
  * @group Ajax
  */
-class AjaxCallbacksTest extends WebDriverTestBase {
+class AjaxCallbacksTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -23,9 +23,11 @@ public function testDateAjaxCallback() {
 
     // Test Ajax callback when date changes.
     $this->drupalGet('ajax_forms_test_ajax_element_form');
-    $this->assertNotEmpty($this->getSession()->getPage()->find('xpath', '//div[@id="ajax_date_value"][text()="No date yet selected"]'));
-    $this->getSession()->executeScript('jQuery("[data-drupal-selector=edit-date]").val("2016-01-01").trigger("change");');
-    $this->assertNotEmpty($this->assertSession()->waitForElement('xpath', '//div[@id="ajax_date_value"]/div[text()="2016-01-01"]'));
+    $this->assertSession()->responseContains('No date yet selected');
+    $this->getSession()->getPage()->fillField('edit-date', '2016-01-01');
+    $this->assertSession()->assertWaitOnAjaxRequest();
+    $this->assertSession()->responseNotContains('No date yet selected');
+    $this->assertSession()->responseContains('2016-01-01');
   }
 
   /**
@@ -35,10 +37,14 @@ public function testDateTimeAjaxCallback() {
 
     // Test Ajax callback when datetime changes.
     $this->drupalGet('ajax_forms_test_ajax_element_form');
-    $this->assertNotEmpty($this->getSession()->getPage()->find('xpath', '//div[@id="ajax_datetime_value"][text()="No datetime selected."]'));
-    $this->getSession()->executeScript('jQuery("[data-drupal-selector=edit-datetime-date]").val("2016-01-01");');
-    $this->getSession()->executeScript('jQuery("[data-drupal-selector=edit-datetime-time]").val("12:00:00").trigger("change");');
-    $this->assertNotEmpty($this->assertSession()->waitForElement('xpath', '//div[@id="ajax_datetime_value"]/div[text()="2016-01-01 12:00:00"]'));
+    $this->assertSession()->responseContains('No datetime selected.');
+    $this->getSession()->getPage()->fillField('edit-datetime-date', '2016-01-01');
+    $this->assertSession()->assertWaitOnAjaxRequest();
+    $this->assertSession()->responseNotContains('No datetime selected.');
+    $this->assertSession()->responseContains('2016-01-01');
+    $this->getSession()->getPage()->fillField('edit-datetime-time', '12:00:00');
+    $this->assertSession()->assertWaitOnAjaxRequest();
+    $this->assertSession()->responseContains('2016-01-01 12:00:00');
   }
 
 }
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php
index bfd890a04f755cf5645196e689a6470fedf57df2..4811a350ac7da3c5d50cf951ead3f72d4d4fd431 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\FunctionalJavascriptTests\Ajax;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the Ajax image buttons work with key press events.
  *
  * @group Ajax
  */
-class AjaxFormImageButtonTest extends WebDriverTestBase {
+class AjaxFormImageButtonTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
index 06b64af67b2281400740d93247a1549e386e6e24..3d174b04df1325c9f1429645fa66479cad0ee01f 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\FunctionalJavascriptTests\Ajax;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Performs tests on AJAX forms in cached pages.
  *
  * @group Ajax
  */
-class AjaxFormPageCacheTest extends WebDriverTestBase {
+class AjaxFormPageCacheTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
@@ -41,6 +41,7 @@ protected function getFormBuildId() {
    */
   public function testSimpleAJAXFormValue() {
     $this->drupalGet('ajax_forms_test_get_form');
+    $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
     $build_id_initial = $this->getFormBuildId();
 
     // Changing the value of a select input element, triggers a AJAX
@@ -76,6 +77,7 @@ public function testSimpleAJAXFormValue() {
     // Emulate a push of the reload button and then repeat the test sequence
     // this time with a page loaded from the cache.
     $session->reload();
+    $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
     $build_id_from_cache_initial = $this->getFormBuildId();
     $this->assertEquals($build_id_initial, $build_id_from_cache_initial, 'Build id is the same as on the first request');
 
@@ -113,9 +115,7 @@ public function testAjaxElementValidation() {
     $this->drupalGet('ajax_validation_test');
     // Changing the value of the textfield will trigger an AJAX
     // request/response.
-    $field = $this->getSession()->getPage()->findField('drivertext');
-    $field->setValue('some dumb text');
-    $field->blur();
+    $this->getSession()->getPage()->fillField('drivertext', 'some dumb text');
 
     // When the AJAX command updates the DOM a <ul> unsorted list
     // "message__list" structure will appear on the page echoing back the
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
index fa2a3e45c02fd30b2a9c0496d0a090abbe3e9b61..e05940537c4730e752b2dbe3ff0fe5abd6d86a86 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\FunctionalJavascriptTests\Ajax;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests AJAX responses.
  *
  * @group Ajax
  */
-class AjaxTest extends WebDriverTestBase {
+class AjaxTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php
index 9a45583b7c2cbdb6c2f0007a32654043a7fda78c..077c3aa1ae36f2eb6c6cdf82692e7bbe08a7100d 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\FunctionalJavascriptTests\Ajax;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the compatibility of the ajax.es6.js file.
  *
  * @group Ajax
  */
-class BackwardCompatibilityTest extends WebDriverTestBase {
+class BackwardCompatibilityTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
index 56715e6dd1355e78866a7635229098e874299372..e2ecaea7a468d9aeb9f1fa5fc86d4b6372216f90 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
@@ -2,14 +2,20 @@
 
 namespace Drupal\FunctionalJavascriptTests\Ajax;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the throbber.
  *
  * @group Ajax
  */
-class ThrobberTest extends WebDriverTestBase {
+class ThrobberTest extends JavascriptTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php
index 1c76c26ea350b2fff36bdef059b2fef9eceae09b..92b3a739f646801be3d8e17989c93063038ed0aa 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\FunctionalJavascriptTests\Core\Form;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests for form grouping elements.
  *
  * @group form
  */
-class FormGroupingElementsTest extends WebDriverTestBase {
+class FormGroupingElementsTest extends JavascriptTestBase {
 
   /**
    * Required modules.
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php
index a6c59d115297f2d242caa766cdc8c7e2477e78f6..efad210c6a89968c2a2b6f44392d24f9d822ee8c 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Installer/Form/SelectProfileFormTest.php
@@ -6,7 +6,7 @@
 use Drupal\Core\Language\Language;
 use Drupal\Core\Session\UserSession;
 use Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use GuzzleHttp\HandlerStack;
 use Symfony\Component\DependencyInjection\Reference;
 use Symfony\Component\HttpFoundation\Request;
@@ -17,7 +17,7 @@
  *
  * @group Installer
  */
-class SelectProfileFormTest extends WebDriverTestBase {
+class SelectProfileFormTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
index 71bdc982e6eab93635a843a0f34f98a5dbfd2d29..bf2643da6a536a3855d90d89635326489e8840a2 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\FunctionalJavascriptTests\Core;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests for the machine name field.
  *
  * @group field
  */
-class MachineNameTest extends WebDriverTestBase {
+class MachineNameTest extends JavascriptTestBase {
 
   /**
    * Required modules.
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php
index f4a180038242fb9917faa20eff10bdde3874a246..fa2d541c8a8b18f1e0ce24865a3198c4632f48eb 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\FunctionalJavascriptTests\Core\Session;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\menu_link_content\Entity\MenuLinkContent;
 
 /**
@@ -10,7 +10,7 @@
  *
  * @group session
  */
-class SessionTest extends WebDriverTestBase {
+class SessionTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php
index 4bfe3e0b3ae18525eda8770e325791ea5ad3bd5f..19cf5a4b359aaa6fc905f887cff7722cd8e85ba8 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php
@@ -2,14 +2,14 @@
 
 namespace Drupal\FunctionalJavascriptTests\Dialog;
 
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests the JavaScript functionality of the dialog position.
  *
  * @group dialog
  */
-class DialogPositionTest extends WebDriverTestBase {
+class DialogPositionTest extends JavascriptTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php
index f67e738baf0c2c0543620107658719321dc94ffb..5f243af67094f653f15eeb1e2658ae282e83c504 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php
@@ -3,21 +3,12 @@
 namespace Drupal\FunctionalJavascriptTests;
 
 use Behat\Mink\Driver\Selenium2Driver;
-use WebDriver\ServiceFactory;
 
 /**
  * Provides a driver for Selenium testing.
  */
 class DrupalSelenium2Driver extends Selenium2Driver {
 
-  /**
-   * {@inheritdoc}
-   */
-  public function __construct($browserName = 'firefox', $desiredCapabilities = NULL, $wdHost = 'http://localhost:4444/wd/hub') {
-    parent::__construct($browserName, $desiredCapabilities, $wdHost);
-    ServiceFactory::getInstance()->setServiceClass('service.curl', WebDriverCurlService::class);
-  }
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
index 3d0b402a4816708118c188473c92eb3d66ada868..511dee6e32a467714cfaed3bdc5a621ce0b4d4cf 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\FunctionalJavascriptTests\EntityReference;
 
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\simpletest\ContentTypeCreationTrait;
 use Drupal\simpletest\NodeCreationTrait;
 
@@ -12,7 +12,7 @@
  *
  * @group entity_reference
  */
-class EntityReferenceAutocompleteWidgetTest extends WebDriverTestBase {
+class EntityReferenceAutocompleteWidgetTest extends JavascriptTestBase {
 
   use ContentTypeCreationTrait;
   use EntityReferenceTestTrait;
@@ -63,7 +63,7 @@ public function testEntityReferenceAutocompleteWidget() {
     $page = $this->getSession()->getPage();
     $assert_session = $this->assertSession();
 
-    $autocomplete_field = $assert_session->waitForElement('css', '[name="' . $field_name . '[0][target_id]"].ui-autocomplete-input');
+    $autocomplete_field = $page->findField($field_name . '[0][target_id]');
     $autocomplete_field->setValue('Test');
     $this->getSession()->getDriver()->keyDown($autocomplete_field->getXpath(), ' ');
     $assert_session->waitOnAutocomplete();
@@ -87,7 +87,7 @@ public function testEntityReferenceAutocompleteWidget() {
     $this->drupalGet('node/add/page');
     $page = $this->getSession()->getPage();
 
-    $autocomplete_field = $assert_session->waitForElement('css', '[name="' . $field_name . '[0][target_id]"].ui-autocomplete-input');
+    $autocomplete_field = $page->findField($field_name . '[0][target_id]');
     $autocomplete_field->setValue('Test');
     $this->getSession()->getDriver()->keyDown($autocomplete_field->getXpath(), ' ');
     $assert_session->waitOnAutocomplete();
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
index b545f71182766a275882114fdc8bc1c363327b97..44b83c1633db9e055681b3dd527580e03ad40e73 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
@@ -2,33 +2,202 @@
 
 namespace Drupal\FunctionalJavascriptTests;
 
-@trigger_error('The ' . __NAMESPACE__ . '\JavascriptTestBase is deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.0. Instead, use ' . __NAMESPACE__ . '\WebDriverTestBase. See https://www.drupal.org/node/2945059', E_USER_DEPRECATED);
-
+use Drupal\Tests\BrowserTestBase;
+use Zumba\GastonJS\Exception\DeadClient;
 use Zumba\Mink\Driver\PhantomJSDriver;
 
 /**
- * Runs a browser test using PhantomJS.
+ * Runs a browser test using a driver that supports Javascript.
  *
  * Base class for testing browser interaction implemented in JavaScript.
- *
- * @deprecated in Drupal 8.6.x, will be removed before Drupal 9.0.0.
- * Use \Drupal\FunctionalJavascriptTests\WebDriverTestBase instead
- *
- * @see https://www.drupal.org/node/2945059
  */
-abstract class JavascriptTestBase extends WebDriverTestBase {
+abstract class JavascriptTestBase extends BrowserTestBase {
 
   /**
    * {@inheritdoc}
+   *
+   * To use a webdriver based approach, please use DrupalSelenium2Driver::class.
+   * We will switch the default later.
    */
   protected $minkDefaultDriverClass = PhantomJSDriver::class;
 
+  /**
+   * {@inheritdoc}
+   */
+  protected function initMink() {
+    if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
+      $this->minkDefaultDriverArgs = ['chrome', NULL, 'http://localhost:4444/'];
+    }
+    elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) {
+      // Set up the template cache used by the PhantomJS mink driver.
+      $path = $this->tempFilesDirectory . DIRECTORY_SEPARATOR . 'browsertestbase-templatecache';
+      $this->minkDefaultDriverArgs = [
+        'http://127.0.0.1:8510',
+        $path,
+      ];
+      if (!file_exists($path)) {
+        mkdir($path);
+      }
+    }
+
+    try {
+      return parent::initMink();
+    }
+    catch (DeadClient $e) {
+      $this->markTestSkipped('PhantomJS is either not installed or not running. Start it via phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768&');
+    }
+    catch (\Exception $e) {
+      $this->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e->getMessage());
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function tearDown() {
+    if ($this->mink) {
+      // Wait for all requests to finish. It is possible that an AJAX request is
+      // still on-going.
+      $result = $this->getSession()->wait(5000, '(typeof(jQuery)=="undefined" || (0 === jQuery.active && 0 === jQuery(\':animated\').length))');
+      if (!$result) {
+        // If the wait is unsuccessful, there may still be an AJAX request in
+        // progress. If we tear down now, then this AJAX request may fail with
+        // missing database tables, because tear down will have removed them.
+        // Rather than allow it to fail, throw an explicit exception now
+        // explaining what the problem is.
+        throw new \RuntimeException('Unfinished AJAX requests while tearing down a test');
+      }
+    }
+    parent::tearDown();
+  }
+
+  /**
+    * {@inheritdoc}
+    */
+  protected function getMinkDriverArgs() {
+    if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
+      return getenv('MINK_DRIVER_ARGS_WEBDRIVER') ?: getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs();
+    }
+    elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) {
+      return getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs();
+    }
+    return parent::getMinkDriverArgs();
+  }
+
+  /**
+   * Asserts that the element with the given CSS selector is visible.
+   *
+   * @param string $css_selector
+   *   The CSS selector identifying the element to check.
+   * @param string $message
+   *   Optional message to show alongside the assertion.
+   *
+   * @deprecated in Drupal 8.1.0, will be removed before Drupal 9.0.0. Use
+   *   \Behat\Mink\Element\NodeElement::isVisible() instead.
+   */
+  protected function assertElementVisible($css_selector, $message = '') {
+    $this->assertTrue($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message);
+    @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.1.0 and will be removed in 9.0.0. Use \Behat\Mink\Element\NodeElement::isVisible() instead.', E_USER_DEPRECATED);
+  }
+
+  /**
+   * Asserts that the element with the given CSS selector is not visible.
+   *
+   * @param string $css_selector
+   *   The CSS selector identifying the element to check.
+   * @param string $message
+   *   Optional message to show alongside the assertion.
+   *
+   * @deprecated in Drupal 8.1.0, will be removed before Drupal 9.0.0. Use
+   *   \Behat\Mink\Element\NodeElement::isVisible() instead.
+   */
+  protected function assertElementNotVisible($css_selector, $message = '') {
+    $this->assertFalse($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message);
+    @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.1.0 and will be removed in 9.0.0. Use \Behat\Mink\Element\NodeElement::isVisible() instead.', E_USER_DEPRECATED);
+  }
+
+  /**
+   * Waits for the given time or until the given JS condition becomes TRUE.
+   *
+   * @param string $condition
+   *   JS condition to wait until it becomes TRUE.
+   * @param int $timeout
+   *   (Optional) Timeout in milliseconds, defaults to 10000.
+   * @param string $message
+   *   (optional) A message to display with the assertion. If left blank, a
+   *   default message will be displayed.
+   *
+   * @throws \PHPUnit_Framework_AssertionFailedError
+   *
+   * @see \Behat\Mink\Driver\DriverInterface::evaluateScript()
+   */
+  protected function assertJsCondition($condition, $timeout = 10000, $message = '') {
+    $message = $message ?: "Javascript condition met:\n" . $condition;
+    $result = $this->getSession()->getDriver()->wait($timeout, $condition);
+    $this->assertTrue($result, $message);
+  }
+
+  /**
+   * Creates a screenshot.
+   *
+   * @param string $filename
+   *   The file name of the resulting screenshot. If using the default phantomjs
+   *   driver then this should be a JPG filename.
+   * @param bool $set_background_color
+   *   (optional) By default this method will set the background color to white.
+   *   Set to FALSE to override this behaviour.
+   *
+   * @throws \Behat\Mink\Exception\UnsupportedDriverActionException
+   *   When operation not supported by the driver.
+   * @throws \Behat\Mink\Exception\DriverException
+   *   When the operation cannot be done.
+   */
+  protected function createScreenshot($filename, $set_background_color = TRUE) {
+    $session = $this->getSession();
+    if ($set_background_color) {
+      $session->executeScript("document.body.style.backgroundColor = 'white';");
+    }
+    $image = $session->getScreenshot();
+    file_put_contents($filename, $image);
+  }
+
   /**
    * {@inheritdoc}
    */
   public function assertSession($name = NULL) {
-    // Return a WebAssert that supports status code and header assertions.
-    return new JSWebAssert($this->getSession($name), $this->baseUrl);
+    return new WebDriverWebAssert($this->getSession($name), $this->baseUrl);
+  }
+
+  /**
+   * Gets the current Drupal javascript settings and parses into an array.
+   *
+   * Unlike BrowserTestBase::getDrupalSettings(), this implementation reads the
+   * current values of drupalSettings, capturing all changes made via javascript
+   * after the page was loaded.
+   *
+   * @return array
+   *   The Drupal javascript settings array.
+   *
+   * @see \Drupal\Tests\BrowserTestBase::getDrupalSettings()
+   */
+  protected function getDrupalSettings() {
+    $script = <<<EndOfScript
+(function () {
+  if (typeof drupalSettings !== 'undefined') {
+    return drupalSettings;
+  }
+})();
+EndOfScript;
+
+    return $this->getSession()->evaluateScript($script) ?: [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getHtmlOutputHeaders() {
+    // The webdriver API does not support fetching headers.
+    return '';
   }
 
 }
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php
index 70869d08b4e156a0297c0cbbd451c145b4d1383d..b3baf6e2d377b6793728bfb1dd70394215f7ee07 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/LegacyJavascriptTestBase.php
@@ -2,14 +2,26 @@
 
 namespace Drupal\FunctionalJavascriptTests;
 
+use Zumba\Mink\Driver\PhantomJSDriver;
+
 /**
  * Runs a browser test using PhantomJS.
  *
- * @deprecated in Drupal 8.6.0, will be removed before Drupal 9.0.0.
- * Use \Drupal\FunctionalJavascriptTests\WebDriverTestBase instead
- *
- * BC layer for testing browser interaction implemented in JavaScript.
+ * Base class for testing browser interaction implemented in JavaScript.
  */
 abstract class LegacyJavascriptTestBase extends JavascriptTestBase {
 
+  /**
+   * {@inheritdoc}
+   */
+  protected $minkDefaultDriverClass = PhantomJSDriver::class;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function assertSession($name = NULL) {
+    // Return a WebAssert that supports status code and header assertions.
+    return new JSWebAssert($this->getSession($name), $this->baseUrl);
+  }
+
 }
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php
index 6dd591f5fe4f1403e6a55e210fad1447ea8d2877..36f6340f727948de61732d5f1e1d685cbff09555 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php
@@ -3,14 +3,14 @@
 namespace Drupal\FunctionalJavascriptTests\Tests;
 
 use Behat\Mink\Element\NodeElement;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 
 /**
  * Tests for the JSWebAssert class.
  *
  * @group javascript
  */
-class JSWebAssertTest extends WebDriverTestBase {
+class JSWebAssertTest extends JavascriptTestBase {
 
   /**
    * Required modules.
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php
deleted file mode 100644
index 13991afd5da6f60b13198e282bc1790afa2ca4cf..0000000000000000000000000000000000000000
--- a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-namespace Drupal\FunctionalJavascriptTests;
-
-use WebDriver\Service\CurlService;
-use WebDriver\Exception\CurlExec;
-use WebDriver\Exception as WebDriverException;
-
-/**
- * Provides a curl service to interact with Selenium driver.
- *
- * Extends WebDriver\Service\CurlService to solve problem with race conditions,
- * when multiple processes requests.
- */
-class WebDriverCurlService extends CurlService {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function execute($requestMethod, $url, $parameters = NULL, $extraOptions = []) {
-    $extraOptions += [
-      CURLOPT_FAILONERROR => TRUE,
-    ];
-    $retries = 0;
-    while ($retries < 10) {
-      try {
-        $customHeaders = [
-          'Content-Type: application/json;charset=UTF-8',
-          'Accept: application/json;charset=UTF-8',
-        ];
-
-        $curl = curl_init($url);
-        curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
-
-        switch ($requestMethod) {
-          case 'GET':
-            break;
-
-          case 'POST':
-            if ($parameters && is_array($parameters)) {
-              curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters));
-            }
-            else {
-              $customHeaders[] = 'Content-Length: 0';
-            }
-
-            // Suppress "Expect: 100-continue" header automatically added by
-            // cURL that causes a 1 second delay if the remote server does not
-            // support Expect.
-            $customHeaders[] = 'Expect:';
-
-            curl_setopt($curl, CURLOPT_POST, TRUE);
-            break;
-
-          case 'DELETE':
-            curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
-            break;
-
-          case 'PUT':
-            if ($parameters && is_array($parameters)) {
-              curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters));
-            }
-            else {
-              $customHeaders[] = 'Content-Length: 0';
-            }
-
-            // Suppress "Expect: 100-continue" header automatically added by
-            // cURL that causes a 1 second delay if the remote server does not
-            // support Expect.
-            $customHeaders[] = 'Expect:';
-
-            curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
-            break;
-        }
-
-        foreach ($extraOptions as $option => $value) {
-          curl_setopt($curl, $option, $value);
-        }
-
-        curl_setopt($curl, CURLOPT_HTTPHEADER, $customHeaders);
-
-        $rawResult = trim(curl_exec($curl));
-
-        $info = curl_getinfo($curl);
-        $info['request_method'] = $requestMethod;
-
-        if (array_key_exists(CURLOPT_FAILONERROR, $extraOptions) && $extraOptions[CURLOPT_FAILONERROR] && CURLE_GOT_NOTHING !== ($errno = curl_errno($curl)) && $error = curl_error($curl)) {
-          curl_close($curl);
-
-          throw WebDriverException::factory(WebDriverException::CURL_EXEC, sprintf("Curl error thrown for http %s to %s%s\n\n%s", $requestMethod, $url, $parameters && is_array($parameters) ? ' with params: ' . json_encode($parameters) : '', $error));
-        }
-
-        curl_close($curl);
-
-        $result = json_decode($rawResult, TRUE);
-        if (isset($result['status']) && $result['status'] === WebDriverException::STALE_ELEMENT_REFERENCE) {
-          usleep(100000);
-          $retries++;
-          continue;
-        }
-        return [$rawResult, $info];
-      }
-      catch (CurlExec $exception) {
-        $retries++;
-      }
-    }
-    throw WebDriverException::factory(WebDriverException::CURL_EXEC, sprintf("Curl error thrown for http %s to %s%s\n\n%s", $requestMethod, $url, $parameters && is_array($parameters) ? ' with params: ' . json_encode($parameters) : '', $error));
-  }
-
-}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
deleted file mode 100644
index 1d32371cea4bb9c7a2d993e854f30300cfb70869..0000000000000000000000000000000000000000
--- a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-
-namespace Drupal\FunctionalJavascriptTests;
-
-use Drupal\Tests\BrowserTestBase;
-use Zumba\GastonJS\Exception\DeadClient;
-use Zumba\Mink\Driver\PhantomJSDriver;
-
-/**
- * Runs a browser test using a driver that supports Javascript.
- *
- * Base class for testing browser interaction implemented in JavaScript.
- */
-abstract class WebDriverTestBase extends BrowserTestBase {
-
-  /**
-   * {@inheritdoc}
-   *
-   * To use a legacy phantomjs based approach, please use PhantomJSDriver::class.
-   */
-  protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function initMink() {
-    if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
-      $this->minkDefaultDriverArgs = ['chrome', NULL, 'http://localhost:4444/'];
-    }
-    elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) {
-      // Set up the template cache used by the PhantomJS mink driver.
-      $path = $this->tempFilesDirectory . DIRECTORY_SEPARATOR . 'browsertestbase-templatecache';
-      $this->minkDefaultDriverArgs = [
-        'http://127.0.0.1:8510',
-        $path,
-      ];
-      if (!file_exists($path)) {
-        mkdir($path);
-      }
-    }
-
-    try {
-      return parent::initMink();
-    }
-    catch (DeadClient $e) {
-      $this->markTestSkipped('PhantomJS is either not installed or not running. Start it via phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768&');
-    }
-    catch (\Exception $e) {
-      $this->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e->getMessage());
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function tearDown() {
-    if ($this->mink) {
-      // Wait for all requests to finish. It is possible that an AJAX request is
-      // still on-going.
-      $result = $this->getSession()->wait(5000, '(typeof(jQuery)=="undefined" || (0 === jQuery.active && 0 === jQuery(\':animated\').length))');
-      if (!$result) {
-        // If the wait is unsuccessful, there may still be an AJAX request in
-        // progress. If we tear down now, then this AJAX request may fail with
-        // missing database tables, because tear down will have removed them.
-        // Rather than allow it to fail, throw an explicit exception now
-        // explaining what the problem is.
-        throw new \RuntimeException('Unfinished AJAX requests while tearing down a test');
-      }
-    }
-    parent::tearDown();
-  }
-
-  /**
-    * {@inheritdoc}
-    */
-  protected function getMinkDriverArgs() {
-    if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
-      return getenv('MINK_DRIVER_ARGS_WEBDRIVER') ?: getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs();
-    }
-    elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) {
-      return getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs();
-    }
-    return parent::getMinkDriverArgs();
-  }
-
-  /**
-   * Asserts that the element with the given CSS selector is visible.
-   *
-   * @param string $css_selector
-   *   The CSS selector identifying the element to check.
-   * @param string $message
-   *   Optional message to show alongside the assertion.
-   *
-   * @deprecated in Drupal 8.1.0, will be removed before Drupal 9.0.0. Use
-   *   \Behat\Mink\Element\NodeElement::isVisible() instead.
-   */
-  protected function assertElementVisible($css_selector, $message = '') {
-    $this->assertTrue($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message);
-    @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.1.0 and will be removed in 9.0.0. Use \Behat\Mink\Element\NodeElement::isVisible() instead.', E_USER_DEPRECATED);
-  }
-
-  /**
-   * Asserts that the element with the given CSS selector is not visible.
-   *
-   * @param string $css_selector
-   *   The CSS selector identifying the element to check.
-   * @param string $message
-   *   Optional message to show alongside the assertion.
-   *
-   * @deprecated in Drupal 8.1.0, will be removed before Drupal 9.0.0. Use
-   *   \Behat\Mink\Element\NodeElement::isVisible() instead.
-   */
-  protected function assertElementNotVisible($css_selector, $message = '') {
-    $this->assertFalse($this->getSession()->getDriver()->isVisible($this->cssSelectToXpath($css_selector)), $message);
-    @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.1.0 and will be removed in 9.0.0. Use \Behat\Mink\Element\NodeElement::isVisible() instead.', E_USER_DEPRECATED);
-  }
-
-  /**
-   * Waits for the given time or until the given JS condition becomes TRUE.
-   *
-   * @param string $condition
-   *   JS condition to wait until it becomes TRUE.
-   * @param int $timeout
-   *   (Optional) Timeout in milliseconds, defaults to 10000.
-   * @param string $message
-   *   (optional) A message to display with the assertion. If left blank, a
-   *   default message will be displayed.
-   *
-   * @throws \PHPUnit_Framework_AssertionFailedError
-   *
-   * @see \Behat\Mink\Driver\DriverInterface::evaluateScript()
-   */
-  protected function assertJsCondition($condition, $timeout = 10000, $message = '') {
-    $message = $message ?: "Javascript condition met:\n" . $condition;
-    $result = $this->getSession()->getDriver()->wait($timeout, $condition);
-    $this->assertTrue($result, $message);
-  }
-
-  /**
-   * Creates a screenshot.
-   *
-   * @param string $filename
-   *   The file name of the resulting screenshot. If using the default phantomjs
-   *   driver then this should be a JPG filename.
-   * @param bool $set_background_color
-   *   (optional) By default this method will set the background color to white.
-   *   Set to FALSE to override this behaviour.
-   *
-   * @throws \Behat\Mink\Exception\UnsupportedDriverActionException
-   *   When operation not supported by the driver.
-   * @throws \Behat\Mink\Exception\DriverException
-   *   When the operation cannot be done.
-   */
-  protected function createScreenshot($filename, $set_background_color = TRUE) {
-    $session = $this->getSession();
-    if ($set_background_color) {
-      $session->executeScript("document.body.style.backgroundColor = 'white';");
-    }
-    $image = $session->getScreenshot();
-    file_put_contents($filename, $image);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function assertSession($name = NULL) {
-    return new WebDriverWebAssert($this->getSession($name), $this->baseUrl);
-  }
-
-  /**
-   * Gets the current Drupal javascript settings and parses into an array.
-   *
-   * Unlike BrowserTestBase::getDrupalSettings(), this implementation reads the
-   * current values of drupalSettings, capturing all changes made via javascript
-   * after the page was loaded.
-   *
-   * @return array
-   *   The Drupal javascript settings array.
-   *
-   * @see \Drupal\Tests\BrowserTestBase::getDrupalSettings()
-   */
-  protected function getDrupalSettings() {
-    $script = <<<EndOfScript
-(function () {
-  if (typeof drupalSettings !== 'undefined') {
-    return drupalSettings;
-  }
-})();
-EndOfScript;
-
-    return $this->getSession()->evaluateScript($script) ?: [];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getHtmlOutputHeaders() {
-    // The webdriver API does not support fetching headers.
-    return '';
-  }
-
-}