I have used different variations and suggestions from almost a dozen of answers in SO, but nothing seems to help solve this problem I'm about to explain below.
There are a few sites, in which phantomjs screenshots look bad, the content is loaded through javascript after page load is finished, hence the screenshots look to have missing contents. I have also posted an issue to the Github issues page of the project, but the answers do not help.
https://github.com/ariya/phantomjs/issues/14341
One of the site in context is https://angular.io/
I have tried taking screenshot on Page Load Finished, after certain delay using setTimeout, and also tried implementing the waitFor method as described here: Implementing waitFor functionality with phantomjs-node
Any thing better than the attached screenshot of the site would be accepted as an answer. To test what I'm talking about, this code can be used: https://github.com/crackjack/bulk-shot/
This code works, but gives only a section, as expected. if you increase the height further, the screenshot doesn't come good.
var webPage = require('webpage');
var page = webPage.create();
page.viewportSize = {
width: 1024,
height: 960
};
// Portion of the page to take a screenshot of
page.clipRect = {
top: 0,
left: 0,
width: 1024,
height: 960
};
page.open('https://angular.io/', function (status) {
window.setTimeout(function(){
page.render('angular.jpg');
phantom.exit();
}, 1000);
});
PS: SlimerJS does take the screenshots fine, I feel it is a WebKit v/s Gecko thing here.