I started using PhantomJS a few days ago with NodeJS. I am using this library to integrate with it: https://github.com/amir20/phantomjs-node. Everything worked perfectlly but when I tried to continue the flow of my applcation after a page load (from the callback) something went wrong.
function doStuff () { page.open("http://stackoverflow.com/") .then(function (status) { function responseHandler(status) { console.log("loaded"); iAmHere(); console.log("Here Again"); } function loginAction() { var btn = document.querySelector("#button"); btn.click(); } page.property('onLoadFinished', responseHandler); page.evaluate(loginAction) } ); } function iAmHere (){ console.log("iAmHere"); } The #button element triggers some page load, The responseHandler function is called and the output is:
info: loaded
and the function iAmHere doesn't get called at all and niether the log that follows the call. What did I do wrong?
Thanks!