How to I check that the length of text of an element is greater than 0 in nightwatch?
I want to check the length of text of an element on a page to make sure it is greater than 0 using nightwatch.
You can make your own custom command that uses browser.assert.
module.exports = {
'Length of text should be greater zero': function(browser) {
browser
.url('..')
.getText('#some-selector', function(result) {
browser.assert.ok(result.value.length > 0);
})
.end();
}
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.