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:
You are now ready to run a WebDriver test with NodeJS on our grid.
Please take a look at the following example, this only 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:api_secret@hub.testingbot.com/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 Afterbrowser = wd.remote(url.parse('http://api_key:api_secret@hub.testingbot.com/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.
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
-
WebDriverIO
Webdriver/Selenium 2.0 Javascript bindings for NodeJS
-
CodeceptJS
Run acceptance tests with CodeceptJS on TestingBot.
-
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 websites and applications.
-
Hermione
Hermione is a Test Framework similar to WebDriverIO, with automatic test retries and plugins.