Working of Nightwatch.js

Profile picture for user devraj

Nightwatch works by communicating over a restful HTTP api with a WebDriver server. The restful API protocol is defined by the W3C WebDriver API. Here WebDriver is a general purpose library for automating web browser which support many languages. Webdriver provides a platform and a restful HTTP api as a way for web browsers to be remotely controlled.

Nighwatch sends at least 2 requests to the WebDriver server most of the times. These requests are need in order to perform a command or assertion.

First request is used to locate an element using XPath or CSS selector and Second request is used to perform the actual command or assertion on the given element.