var conf = require('../../nightwatch.conf.js');
module.exports = {
'Demo test' : function (browser) {
browser
.url('http://localhost/myWebsite?newwindow=0')
.waitForElementVisible('body', 6000)
.setValue('input[name=txtLogin]', 'login')
.setValue('input[name=txtPassword]', 'password')
.waitForElementVisible('input.btnLogin', 2000)
.click('button[id=btnLogin]')
.pause(6000)
.assert.elementPresent("#selectTitle")
.assert.containsText('#selectTitle', 'schedules')
.assert.urlContains('login/login_start.asp')
.saveScreenshot(conf.imgpath(browser) + 'titleScreen.png')
.end();
}
}; Running: Demo test
√ Element <body> was visible after 41 milliseconds.
ERROR: Unable to locate element: "input[name=txtLogin]" using: css selector
at Object.Demo test (C:\Workspace\myWebsite\learn-nightwatch\test\e2e\My_Test.js:8:8)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
ERROR: Unable to locate element: "input[name=txtPassword]" using: css selector
at Object.Demo test (C:\Workspace\myWebsite\learn-nightwatch\test\e2e\My_Test.js:9:8)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
× Timed out while waiting for element <input.btnLogin> to be present for 2000 milliseconds. - expected "visible" but got: "not found"
at Object.Demo test (C:\Workspace\myWebsite\learn-nightwatch\test\e2e\My_Test.js:10:8)
at _combinedTickCallback (internal/process/next_tick.js:67:7) <input type="text" class="inputText" id="txtLogin" name="txtLogin" >
<input type="password" class="inputText" id="txtPassword" name="txtPassword" >