I'm using nightwatch with selenium for automation testing. I'm trying to use the selenium command 'elements' which takes a css selector or xpath as the first parameter, but keep getting the following error :
Error while running elements command: Please provide any of the following using strings as the first parameter: class name, css selector, id, name, link text, partial link text, tag name or xpath
My use is like this:
module.exports = {
"My test" : function (browser) {
...
// want to get all the input elements from the document
browser.elements('input','name', function(els){
// of xpath like this
browser.elements('//input','name', function(els){
});
}
}
Any ideas why I'm getting this error? Thanks!
Ah I figured it out - the first param is a keyword which has to be one of these (from nightwatch selenium protocols.js) var check = /class name|css selector|id|name|link text|partial link text|tag name|xpath/gi;
So the command needs to look like this : browser.elements('tag name', 'input', function(el){ })
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