I've trying to load a page with PhantomJS and save it as a .png. However, the png that is created does not look like the original and is missing most of the body. Searching online, most of the similar problems were due to not waiting long enough to load the page. However, that hasn't resolved my issue. This is what I'm running:
var page = require('webpage').create();
var websiteAddress = 'http://poe.ninja/standard/currency';
page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36';
//viewportSize being the actual size of the headless browser
page.viewportSize = { width: 1920, height: 1080 };
//the clipRect is the portion of the page you are taking a screenshot of
page.clipRect = { top: 0, left: 0, width: 1920, height: 1080 };
page.open(websiteAddress, function (status) {
setTimeout(function(){
page.render('output.png');
phantom.exit();
}, 5000); // 5 sec should be enough
});
Am I doing something wrong or is this a bug in PhantomJS?
Here are images of what it should look like and what it actually looks like: