PhantomJS: wait for it

When you want to take screenshots with PhantomJS, you probably need to wait before your page is completely loaded. I mean all resources are loaded and scripts executed. Use the following code to delay your screenshot : var page = new WebPage(); page.open(‘http://stackoverflow.com/’, function (status) { just_wait(); }); function just_wait() { setTimeout(function() { page.render(‘screenshot.png’); phantom.exit(); …