Created
May 13, 2015 06:24
-
-
Save ivanvza/e02d00913a1d13b51c54 to your computer and use it in GitHub Desktop.
Multiple PhantomJs screenshots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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