Skip to content

Instantly share code, notes, and snippets.

@ashwinr
Created January 31, 2013 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashwinr/4685298 to your computer and use it in GitHub Desktop.
Save ashwinr/4685298 to your computer and use it in GitHub Desktop.
phantomjs test file
if (phantom.args.length === 0 || phantom.args.length > 2) {
console.log('Usage: run-qunit.js URL');
phantom.exit();
}
var page = new WebPage();
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.onError = function(msg, trace) {
console.log(msg);
}
page.open(phantom.args[0], function(status) {
if (status !== "success") {
console.log("Unable to access network");
phantom.exit(1);
} else {
page.evaluate(function() {
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment