angularjs - Protractor: addLocator() : 'Cannot read property 'querySelectorAll of null' ' -


i trying run standart example protractor's documentation ( http://angular.github.io/protractor/#/api?view=protractorby.prototype.addlocator ). , have error: 'cannot read property 'queryselectorall of null'

    by.addlocator('buttontextsimple',     function(buttontext, opt_parentelement, opt_rootselector  ) {     var using = opt_parentelement,         buttons = using.queryselectorall('button');     return array.prototype.filter.call(buttons, function(button) {         return button.textcontent === buttontext;         });     }); 

view same:

<button ng-click="doaddition()">go!</button> 

what should solve problem?

you should declare variable called using this:

var using = opt_parentelement || document; 

so if there no optional parent element provided, global document used query results.

not sure if typo in documentation or protractor expected auto-fill opt_parentelement variable defaults if not being set.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -