How to use browser.wait() in zombie.js? How to use browser.wait() in zombie.js? node.js node.js

How to use browser.wait() in zombie.js?


Zombie.js will by default wait untill all the scripts on your page have loaded and executed if they are waiting for document ready.

If I understand you correctly, your script will not execute til after 20 seconds of document ready. In that case Zombie has a function which will let you evaluate javascript in the context of the browser, so you can kick off your ajax code quicker if it is on a timer, and you do not want to wait for it.

Look at browser.evaluate(expr)

Another option would be to simply use a normal JavaScript timeout to wait 20 seconds, and then look at the DOM for the changes you are expecting.

setTimeout(function(){  browser.document.query("#interestingElement")}, 20*1000);