Last active
March 31, 2017 07:56
-
-
Save davidcraig/bb11276e80ce16ee91f0735bc9cad26a to your computer and use it in GitHub Desktop.
PhantomJS - Take a screenshot of a webpage as seen in the browser.
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 website = 'http://www.google.co.uk'; | |
var filename = './google.jpg'; | |
var page = require('webpage').create(); | |
page.viewportSize = { | |
width: 1024, | |
height: 592 | |
}; | |
page.open(website, function(status) { | |
console.log("Status: " + status); | |
if (status === "success") { | |
page.render(filename); | |
} | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment