Created
November 23, 2015 00:12
-
-
Save vitorio/191321ba063949285866 to your computer and use it in GitHub Desktop.
PhantomJS 2 testing
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 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