Skip to content

Instantly share code, notes, and snippets.

@johanlunds
Last active December 19, 2015 06:29
Show Gist options
  • Save johanlunds/5912015 to your computer and use it in GitHub Desktop.
Save johanlunds/5912015 to your computer and use it in GitHub Desktop.
var options, page;
options = {
url: phantom.args[0] || 'http://127.0.0.1:3000/jasmine',
timeout: parseInt(phantom.args[1] || 5000),
specdoc: phantom.args[2] || 'failure',
focus: /true/i.test(phantom.args[3]),
console: phantom.args[4] || 'failure',
errors: phantom.args[5] || 'failure'
};
page = require('webpage').create();
page.onError = function(msg, trace) {
console.log(msg, trace);
};
page.onConsoleMessage = function(msg, line, source) {
console.log(msg, line, source);
};
page.open(options.url, function(status) {
page.onLoadFinished = function() { phantom.exit() };
if (status !== 'success') {
console.log(JSON.stringify({
error: "Unable to access at " + options.url
}));
return phantom.exit();
}
});
<html>
<head>
<title></title>
<script type="text/javascript">
var ls = window.localStorage;
var idb = window.indexedDB || window.webkitIndexedDB;
console.log("localstorage type: ", typeof ls);
console.log("indexedDb type: ", typeof idb);
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment