NodeJS Automated Testing with WD.js

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, this demonstrates webdriver.io without any test frameworks:


describe("using promises and chai-as-promised", function() {
  var browser;

  before(function() {
    browser = wd.remote(url.parse('http://api_key:[email protected]/wd/hub'));
    ...

    return browser.init({browserName:'chrome'});
  });

  beforeEach(function() {
    return browser.get("http://admc.io/wd/test-pages/guinea-pig.html");
  });

  after(function() {
    return browser.quit();
  });

  it("should retrieve the page title", function() {
    return browser.title().should.become("WD Tests");
  });

  it("submit element should be clicked", function() {
    return browser.elementById("submit").click().eval("window.location.href")
      .should.eventually.include("&submit");
  });
});

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
  .init({browserName:'chrome'})

After

browser = wd.remote(url.parse('http://api_key:[email protected]/wd/hub'));
		browser
  .init({browserName:'chrome'})


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.


1. Select a Platform
2. Select a Browser


Other Options

We offer many other 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 for a full list of options to customize your tests.

Pick a NodeJS test framework

  • Webdriver.io

    Webdriver/Selenium 2.0 javascript bindings for NodeJS.

  • Protractor

    Protractor is an end-to-end test framework for AngularJS applications. Protractor is a nodeJS program built on top of WebDriverJS.

  • Soda

    Selenium Node Adapter. A light-weight Selenium RC client for NodeJS.

  • Nightwatch

    Nightwatch.js is an automated testing framework written in NodeJS.

  • Intern

    Intern is a nodeJS framework for testing Web sites and applications.