Skip to content

Instantly share code, notes, and snippets.

@ivanvza
Created May 13, 2015 06:24
Show Gist options
  • Save ivanvza/e02d00913a1d13b51c54 to your computer and use it in GitHub Desktop.
Save ivanvza/e02d00913a1d13b51c54 to your computer and use it in GitHub Desktop.
Multiple PhantomJs screenshots
var page = require('webpage').create();
page.viewportSize = { width: 640, height: 480 };
page.open('<wep page>', function () {
setTimeout(function() {
// Initial frame
var frame = 0;
// Add an interval every 25th second
setInterval(function() {
// Render an image with the frame name
page.render('images/image'+(frame++)+'.png', { format: "png" });
// Exit after 50 images
if(frame > 50) {
phantom.exit();
}
}, 25);
}, 666);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment