Monday 12 June 2017

Nightmare js .then() error

I am trying to work out an error in my code but can't seem to figure it out. I believe the error is with the then statement and it then throws out the error that the wait is not a function. I am trying to check if the name commit exists in the page. Thanks

nightmare
 .goto('http://www.google.com/')
 .evaluate(function () {
      return document.querySelectorAll('[data-style-name="' + "Black" + '"]')[0].click();
 })
 .wait(100)
 .exists('[name="commit"]')
 .then(function(result){
      if(result){
           console.log("This Exists");
      }
 })
 .wait(100)
 .catch(function (error) {
      console.error('Search failed:', error);
 });

The error it throws out is:

TypeError: nightmare.goto(...).evaluate(...).wait(...).exists(...).then(...).wait is not a function



via Noah Cover

No comments:

Post a Comment