diff --git a/composer.lock b/composer.lock
index ddaa66e..a5a9866 100644
--- a/composer.lock
+++ b/composer.lock
@@ -2743,6 +2743,67 @@
             "time": "2016-03-05T09:04:22+00:00"
         },
         {
+            "name": "behat/mink-selenium2-driver",
+            "version": "v1.3.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/minkphp/MinkSelenium2Driver.git",
+                "reference": "473a9f3ebe0c134ee1e623ce8a9c852832020288"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/473a9f3ebe0c134ee1e623ce8a9c852832020288",
+                "reference": "473a9f3ebe0c134ee1e623ce8a9c852832020288",
+                "shasum": ""
+            },
+            "require": {
+                "behat/mink": "~1.7@dev",
+                "instaclick/php-webdriver": "~1.1",
+                "php": ">=5.3.1"
+            },
+            "require-dev": {
+                "symfony/phpunit-bridge": "~2.7"
+            },
+            "type": "mink-driver",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.3.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Behat\\Mink\\Driver\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Konstantin Kudryashov",
+                    "email": "ever.zet@gmail.com",
+                    "homepage": "http://everzet.com"
+                },
+                {
+                    "name": "Pete Otaqui",
+                    "email": "pete@otaqui.com",
+                    "homepage": "https://github.com/pete-otaqui"
+                }
+            ],
+            "description": "Selenium2 (WebDriver) driver for Mink framework",
+            "homepage": "http://mink.behat.org/",
+            "keywords": [
+                "ajax",
+                "browser",
+                "javascript",
+                "selenium",
+                "testing",
+                "webdriver"
+            ],
+            "time": "2016-03-05T09:10:18+00:00"
+        },
+        {
             "name": "doctrine/instantiator",
             "version": "1.0.5",
             "source": {
@@ -2883,6 +2944,65 @@
             "time": "2017-01-03T13:21:43+00:00"
         },
         {
+            "name": "instaclick/php-webdriver",
+            "version": "1.4.5",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/instaclick/php-webdriver.git",
+                "reference": "6fa959452e774dcaed543faad3a9d1a37d803327"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/6fa959452e774dcaed543faad3a9d1a37d803327",
+                "reference": "6fa959452e774dcaed543faad3a9d1a37d803327",
+                "shasum": ""
+            },
+            "require": {
+                "ext-curl": "*",
+                "php": ">=5.3.2"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8",
+                "satooshi/php-coveralls": "^1.0||^2.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.4.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "WebDriver": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Justin Bishop",
+                    "email": "jubishop@gmail.com",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Anthon Pang",
+                    "email": "apang@softwaredevelopment.ca",
+                    "role": "Fork Maintainer"
+                }
+            ],
+            "description": "PHP WebDriver for Selenium 2",
+            "homepage": "http://instaclick.com/",
+            "keywords": [
+                "browser",
+                "selenium",
+                "webdriver",
+                "webtest"
+            ],
+            "time": "2017-06-30T04:02:48+00:00"
+        },
+        {
             "name": "ircmaxell/password-compat",
             "version": "v1.0.4",
             "source": {
diff --git a/core/composer.json b/core/composer.json
index 974626f..46dc0b0 100644
--- a/core/composer.json
+++ b/core/composer.json
@@ -47,7 +47,8 @@
         "phpunit/phpunit": ">=4.8.35 <5",
         "phpspec/prophecy": "^1.4",
         "symfony/css-selector": "~3.2.8",
-        "symfony/phpunit-bridge": "~3.2.8"
+        "symfony/phpunit-bridge": "~3.2.8",
+        "behat/mink-selenium2-driver": "^1.3"
     },
     "replace": {
         "drupal/action": "self.version",
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php
new file mode 100644
index 0000000..b3d7d07
--- /dev/null
+++ b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\FunctionalJavascriptTests;
+
+use Behat\Mink\Driver\Selenium2Driver;
+
+/**
+ * Provides a driver for Selenium testing.
+ */
+class DrupalSelenium2Driver extends Selenium2Driver {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setCookie($name, $value = NULL) {
+    if ($value === NULL) {
+      $this->getWebDriverSession()->deleteCookie($name);
+      return;
+    }
+
+    $cookieArray = [
+      'name' => $name,
+      'value' => urlencode($value),
+      'secure' => FALSE,
+      'domain' => parse_url($this->getWebDriverSession()->url(), PHP_URL_HOST),
+      'expires' => time() + 80000,
+    ];
+
+    $this->getWebDriverSession()->setCookie($cookieArray);
+  }
+
+}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
index 8aa46c7..bbdde6f 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\FunctionalJavascriptTests;
 
+use Behat\Mink\Exception\DriverException;
 use Drupal\Tests\BrowserTestBase;
 use Zumba\GastonJS\Exception\DeadClient;
 use Zumba\Mink\Driver\PhantomJSDriver;
@@ -15,6 +16,9 @@
 
   /**
    * {@inheritdoc}
+   *
+   * To use a webdriver based approach, please use DrupalSelenium2Driver::class.
+   * We will switch the default later.
    */
   protected $minkDefaultDriverClass = PhantomJSDriver::class;
 
@@ -22,14 +26,19 @@
    * {@inheritdoc}
    */
   protected function initMink() {
-    // 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);
+    if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
+      $this->minkDefaultDriverArgs = ['phantomjs'];
+    }
+    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 {
@@ -38,6 +47,9 @@ protected function 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 (DriverException $e) {
+      $this->markTestSkipped($e->getMessage());
+    }
     catch (\Exception $e) {
       $this->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e->getMessage());
     }
@@ -169,4 +181,12 @@ protected function getDrupalSettings() {
     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/Tests/JSWebWithWebDriverAssertTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebWithWebDriverAssertTest.php
new file mode 100644
index 0000000..d31a9a5
--- /dev/null
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebWithWebDriverAssertTest.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace Drupal\FunctionalJavascriptTests\Tests;
+
+use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver;
+
+/**
+ * Tests for the JSWebAssert class using webdriver.
+ *
+ * @group javascript
+ */
+class JSWebWithWebDriverAssertTest extends JSWebAssertTest {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
+
+}
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index e7c79f3..6ac72f3 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -342,7 +342,7 @@ protected function initMink() {
   protected function getDefaultDriverInstance() {
     // Get default driver params from environment if availables.
     if ($arg_json = getenv('MINK_DRIVER_ARGS')) {
-      $this->minkDefaultDriverArgs = json_decode($arg_json);
+      $this->minkDefaultDriverArgs = json_decode($arg_json, TRUE);
     }
 
     // Get and check default driver class from environment if availables.
diff --git a/core/tests/README.md b/core/tests/README.md
index 5dd6cc6..a6258b9 100644
--- a/core/tests/README.md
+++ b/core/tests/README.md
@@ -2,16 +2,11 @@
 
 ## Functional tests
 
-* Start PhantomJS:
-  ```
-  phantomjs --ssl-protocol=any --ignore-ssl-errors=true ./vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null &
-  ```
 * Run the functional tests:
   ```
   export SIMPLETEST_DB='mysql://root@localhost/dev_d8'
   export SIMPLETEST_BASE_URL='http://d8.dev'
   ./vendor/bin/phpunit -c core --testsuite functional
-  ./vendor/bin/phpunit -c core --testsuite functional-javascript
   ```
 
 Note: functional tests have to be invoked with a user in the same group as the
@@ -46,3 +41,30 @@ export SIMPLETEST_BASE_URL='http://d8.dev'
 sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional
 sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional-javascript
 ```
+
+## Functional javascript tests
+
+* Start PhantomJS:
+  ```
+  phantomjs --webdriver=4444
+  ```
+
+* Run the functional javascript tests:
+
+```
+  ./vendor/bin/phpunit -c core --testsuite functional-javascript
+```
+
+* Alternative to use phantomjs you can also use a real browser like
+  firefox/chrome too actually see what the test is doing.
+
+* Install and start selenium, see http://mink.behat.org/en/latest/drivers/selenium2.html
+
+* Set an additional environment parameter to tell the test to use firefox:
+```
+export MINK_DRIVER_ARGS='["firefox", null, "http://localhost:4444/wd/hub"]'
+```
+* Run the tests as before, now a firefox window should appear.
+```
+  ./vendor/bin/phpunit -c core --testsuite functional-javascript
+```
