Skip to content

Instantly share code, notes, and snippets.

@vitorio
Created November 23, 2015 00:12
Show Gist options
  • Save vitorio/191321ba063949285866 to your computer and use it in GitHub Desktop.
Save vitorio/191321ba063949285866 to your computer and use it in GitHub Desktop.
PhantomJS 2 testing
var page = require('webpage').create(),
system = require('system'),
t, address;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
if (system.args.length === 1) {
console.log('Usage: testmess.js <some URL>');
phantom.exit(1);
} else {
address = system.args[1];
page.open(address, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address');
} else {
// you really want this to be something that checks for a JSMESS benchmark to complete
window.setTimeout(function () {
phantom.exit();
}, 30000); // Change timeout as required to allow sufficient time
};
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment