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();
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With