"Elements of the nightwatch selenium command" return an error about the first parameter, even when I pass the css selector or xpath expression

I am using a selenium nightwatch to test automation. I am trying to use the selenium "elements" commands, which take the css or xpath selector as the first parameter, but continue to receive the following error:

Error starting element command: specify any of the following values ​​as the first parameter: class name, css selector, identifier, name, link text, partial link text, tag name or xpath

My use is as follows:

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 get this error? Thank!

+4
source share
1

- - , ( nightwatch selenium protocols.js)  var check =/ | css selector | id | | | | | xpath/gi;

, :   browser.elements('tag name', 'input', function (el) {   })

+12

All Articles