I am writing a test script in Nightwatch.js and before I click this element I am grabbing the containing text and picking out the value
field and assigning this to an externally assigned variable. The problem I am having is that the value is not being assigned within the callback function
The code I have is as follows:
var meeting=""
module.exports = {
'step 1: open event page': function (browser) {
browser
.url('http://example.com')
.waitForElementVisible('.navigation-list-item:nth-of-type(2)', 20000)
.getText('.navigation-view > .list-container > .navigation-list-item:nth-of-type(2) > a > .list-content > .list-body', function (location) {
meeting = location.value;
})
.pause(3000)
.click('.navigation-view > .list-container > .navigation-list-item:nth-of-type(2) > a > .list-content > .list-body')
.pause(3000)
.assert.containsText('.ncb__title', meeting);
}
}
Any help would be appreciated, Cheers!
NOTE: actual URL of site being tested omitted for privacy reasons