 <p>You can create custom commands for that: <a href="http://nightwatchjs.org/guide#writing-custom-commands">http://nightwatchjs.org/guide#writing-custom-commands</a></p> <ol> <li>in nightwatch.json specify the path to the folder that will contain your custom command file</li> <li>create a js file and name it how your custom command should be names (ie login.js)</li> <li>write the code you need:</li> </ol> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>exports.command = function(username, password) { this .waitForElementVisible('#password', 4000) .setValue('#password', password) .waitForElementVisible('#username', 1000) .setValue('#username', username) .waitForElementVisible('#sign_in', 1000) .click('#sign_in') .waitForElementVisible('h1.folder-title', 10000) return this; };</code></pre> </div> </div> </p> <ol start="4"> <li>use the custom command in your test:</li> </ol> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>.login("your_username", "your_password")</code></pre> </div> </div> </p>