---
title: WD.js webdriver test example - Selenium & Appium Testing.
description: WebDriver examples for WD.js - Run Automated tests on real browsers and
  mobile devices.
source_url:
  html: https://testingbot.com/support/web-automate/selenium/nodejs/wd
  md: https://testingbot.com/support/web-automate/selenium/nodejs/wd/index.md
---
# NodeJS Automated Testing with WD.js

WD.js is no longer actively maintained. We recommend using [WebDriverIO](https://testingbot.com/support/web-automate/selenium/nodejs/webdriverio) for new projects.

WD.js is a NodeJS client for WebDriver/Selenium.

Let's start with making sure WD.js is installed:

    npm install wd

You are now ready to run a WebDriver test with NodeJS on our grid.   
 Please take a look at the following example:

    const wd = require('wd');
    const chai = require('chai');
    const chaiAsPromised = require('chai-as-promised');
    
    chai.use(chaiAsPromised);
    chai.should();
    
    const capabilities = {
      'browserName': 'chrome',
      'platformName': 'WIN11',
      'browserVersion': 'latest',
      'tb:options': {
        'key': 'API_KEY',
        'secret': 'API_SECRET',
        'name': 'WD.js Test'
      }
    };
    
    describe("using promises and chai-as-promised", function() {
      let browser;
    
      before(function() {
        browser = wd.promiseChainRemote('hub.testingbot.com', 443, '', '', 'https');
        return browser.init(capabilities);
      });
    
      beforeEach(function() {
        return browser.get("https://testingbot.com/");
      });
    
      after(function() {
        return browser.quit();
      });
    
      it("should retrieve the page title", function() {
        return browser.title().should.eventually.include("TestingBot");
      });
    });

## Configuring capabilities

To run your existing tests on TestingBot, your tests will need to be configured to use the TestingBot remote machines. If the test was running on your local machine or network, you can simply change your existing test like this:

**Before**

    browser = wd.promiseChainRemote();
    browser.init({ browserName: 'chrome' })

**After**

    const capabilities = {
      'browserName': 'chrome',
      'platformName': 'WIN11',
      'browserVersion': 'latest',
      'tb:options': {
        'key': 'API_KEY',
        'secret': 'API_SECRET'
      }
    };
    
    browser = wd.promiseChainRemote('hub.testingbot.com', 443, '', '', 'https');
    browser.init(capabilities);

### Specifying the operating system, browser and version

To let TestingBot know on which browser/platform you want to run your test on, you need to specify the browsername, version, OS and other optional options in the capabilities field.

To see how to do this, please select a combination of browser, version and platform in the drop-down menus below.

  ![OS selected](https://testingbot.com/assets/environments/svg/windows11-0e1b28bc0fdd5034d3e4d3dc8d346c500a8c6522facf4b45d0da56537c1f1c6d.svg) Windows 11 › ![Browser Selected](https://testingbot.com/assets/environments/svg/chrome-c4081ff447d2d898d4afcb8f074a907c960e6f007716c1a1d119eee6803c4042.svg) Chrome 139 

Loading environments...

Please wait while we load the available browsers and platforms.

    

## Other Options

We offer many other [test options](https://testingbot.com/support/web-automate/selenium/test-options), for example: disable video recording, specifying a custom Firefox Profile, loading Chrome/Firefox/Safari extensions, running an executable before your test starts, uploading files, ...  
See our [list of test options](https://testingbot.com/support/web-automate/selenium/test-options) for a full list of options to customize your tests.

## Other NodeJS Framework examples

- [WebDriverIO (Recommended)](https://testingbot.com/support/web-automate/selenium/nodejs/webdriverio)

With WebDriverIO you can run Mocha, Jasmine and Cucumber tests.

- [CodeceptJS](https://testingbot.com/support/web-automate/selenium/nodejs/codeceptjs)

Run acceptance tests with CodeceptJS on TestingBot.

- [Nightwatch](https://testingbot.com/support/web-automate/selenium/nodejs/nightwatch)

Nightwatch is an automated testing framework written in NodeJS.

- [TestCafe](https://testingbot.com/support/web-automate/selenium/nodejs/testcafe)

TestCafe is a NodeJS framework for end-to-end web testing.

- [Hermione](https://testingbot.com/support/web-automate/selenium/nodejs/hermione)

Hermione is a Test Framework similar to WebDriverIO, with automatic test retries and plugins.

### Looking for more help?

Have questions or need more information? Reach out via email or Slack.

[Email us](https://testingbot.com/contact/new)[Slack Join our Slack](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
