When comparing Nightwatch.js vs webdriver-sync, the Slant community recommends webdriver-sync for most people. In the question“What are the best Node.JS Selenium WebDriver client libraries / bindings?” webdriver-sync is ranked 3rd while Nightwatch.js is ranked 5th. The most important reason people chose webdriver-sync is:
### webdriver-sync avoids this browser.get("http://foo.html", function() { browser.title(function(err, title) { assert.ok(~title.indexOf('foo title'), 'Wrong title!'); browser.elementById('i am a link', function(err, el) { browser.clickElement(el, function() { browser.eval("window.location.href", function(err, href) { assert.ok(~href.indexOf('foo title 2')); browser.quit(); }); }); }); }); }); ### in favor of this - completely synchronous API! No promises or callbacks needed: driver.get("http://foo.html"); title = driver.getTitle(); link = driver.findElement(By.id('i am a link')); link.click(); assert(driver.getCurrentUrl().indexOf('foo title 2') > -1); title.should.equal('foo title'); console.log(title); driver.quit();
Ranked in these QuestionsQuestion Ranking
Pros

Pro You don't have to choose a testing framework
Nightwatch solves the Paradox of Choice among testing frameworks such as Jasmine, Cucumber or Mocha+Chai, by including its own BDD-style assertion library, based on Chai.
Pro Includes its own testing framework / assertions library
Pro Test organization is out of the box
Supports page object model, custom commands, custom assertions, and globals.js.

Pro 3rd party integration with Cucumber
Though Cucumber is not officially supported, Nightwatch can be used with Cucumber.

Pro Synchronous. No promises or callbacks needed.
browser.get("http://foo.html", function() {
browser.title(function(err, title) {
assert.ok(~title.indexOf('foo title'), 'Wrong title!');
browser.elementById('i am a link', function(err, el) {
browser.clickElement(el, function() {
browser.eval("window.location.href", function(err, href) {
assert.ok(~href.indexOf('foo title 2'));
browser.quit();
});
});
});
});
});
in favor of this - completely synchronous API! No promises or callbacks needed:driver.get("http://foo.html");
title = driver.getTitle();
link = driver.findElement(By.id('i am a link'));
link.click();
assert(driver.getCurrentUrl().indexOf('foo title 2') > -1);
title.should.equal('foo title');
console.log(title);
driver.quit();

Pro Same API as Selenium Java
If you've used the Selenium API before, you won't have to learn a new API.
Cons

Con No official BDD-style syntax support

Con Includes its own testing framework / assertions library
Unlike WebdriverIO, which lets you use various test frameworks and assertion libraries (e.g. Jasmine, Cucumber, Mocha + Chai), Nightwatch comes with its own BDD-style interface for performing assertions, based on Chai.
Here's a simple test example:
module.exports = {
'Demo test Google' : function (browser) {
browser
.url('http://www.google.com')
.waitForElementVisible('body', 1000)
.setValue('input[type=text]', 'nightwatch')
.waitForElementVisible('button[name=btnG]', 1000)
.click('button[name=btnG]')
.pause(1000)
.assert.containsText('#main', 'Night Watch')
.end();
}
};
Con Difficult to install on Windows
Due to the dependencies for installing on Windows, the process can be tedious (Requires Python 2.7 and Visual Studio).
