Created
October 8, 2012 23:30
-
-
Save pilate/3855613 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 system = require('system'); | |
// Check argument count | |
if (system.args.length === 2) { | |
var url = system.args[1]; | |
} | |
else { | |
// Quit without correct arguments | |
console.log("URL Parameter Required."); | |
phantom.exit(); | |
} | |
// Create new WebPage object for browsing | |
var page = new WebPage(); | |
// Callback for page onload | |
page.onLoadFinished = function (msg) { | |
// Take a screenshot and exit | |
page.render("page.png"); | |
phantom.exit(); | |
} | |
// Browse to url | |
page.open(url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment