Skip to content

Instantly share code, notes, and snippets.

@gabhi
Created April 2, 2015 05:43
Show Gist options
  • Select an option

  • Save gabhi/202c19dc12f5a3f54f12 to your computer and use it in GitHub Desktop.

Select an option

Save gabhi/202c19dc12f5a3f54f12 to your computer and use it in GitHub Desktop.
phantonjs node js screenshot of a website
var phantom = require('phantom');
var website_name = "amazon.in";
var takeScreenShot = function(website_name) {
phantom.create(function(ph) {
ph.createPage(function(page) {
page.open("http://" + website_name, function(status) {
if (status === "success") {
page.render("./images/"+website_name + '.png');
}
ph.exit();
});
});
});
}
takeScreenShot(website_name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment