Skip to content

Instantly share code, notes, and snippets.

@foo9
Created August 3, 2014 08:40
Show Gist options
  • Save foo9/eb8c617e15c9071dcaca to your computer and use it in GitHub Desktop.
Save foo9/eb8c617e15c9071dcaca to your computer and use it in GitHub Desktop.
phantomjs capture.js
var system = require('system');
var url = system.args[1];
var page = require('webpage').create();
page.viewportSize = { width: 1024, height: 800 };
page.open(url, function(status) {
if (status === 'success') {
setTimeout(function() {
page.evaluate(function() {
document.body.style.backgroundColor = 'white';
});
page.render('screen.png');
phantom.exit();
}, 1000);
} else {
phantom.exit();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment