Reputation: 4798
New to nightwatch.js. While writing my first tests, I cannot find conventional ways to 'grab' elements that I want to test using assertions.
Say I have an input field:
<input id="myInput"></input>
How can I create a selector for this?
I've tried the following, which definitely is the wrong syntax:
module.exports = {
'Initial Test': function(browser) {
browser
.url('http://127.0.0.1:51260/index.html') //insert your local path
.waitForElementVisible('body')
.assert.title('First Test')
.expect.element('input[id=myInput]').to.be.visible;
browser.end();
}
};
Upvotes: 4
Views: 6281
Reputation: 6398
try
module.exports = {
'Initial Test': function(browser) {
browser
.url('http://127.0.0.1:51260/index.html') //insert your local path
.waitForElementVisible('body')
.assert.title('First Test')
.waitForElementVisible('input[id=myInput]', 1000)
.setValue('input[id=myInput]', 'write something')
.end();
}
};
Reference:
Upvotes: 3