Created
February 23, 2015 16:15
-
-
Save euperia/5029442cdaf23432707f to your computer and use it in GitHub Desktop.
Screengrab a website with phantom.js
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
/** | |
* Phantomgrab - take a screenshot of a webpage | |
* | |
* Run with: | |
* phantomjs --ssl-protocol=any --ignore-ssl-errors=true phantomgrab.js | |
* | |
*/ | |
var page = require('webpage').create(); | |
var url = 'https://www.google.com/'; | |
var file = 'screenshot.png'; | |
page.viewportSize = { width: 1280, height: 800 }; | |
page.open(url, function() { | |
window.setTimeout(function() { | |
page.render(file); | |
phantom.exit(); | |
}, 2000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment