Currently, I am in the process of creating a test script using Nightwatch.js. Before clicking on an element, I am extracting the text within it and isolating the value
field to assign it to an externally declared variable. However, I am encountering an issue where the value is not being assigned within the callback function.
Here is the snippet of code that I am working with:
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);
}
}
I would greatly appreciate any assistance or insights on this matter. Thank you!
NOTE: The actual URL of the site under testing has been excluded for confidentiality reasons.