Skip to content

Instantly share code, notes, and snippets.

@phadej
Created June 5, 2013 02:21
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 phadej/5711191 to your computer and use it in GitHub Desktop.
Save phadej/5711191 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="tests/lib/winjs/base.js"></script>
</head>
<body>
</body>
</html>
console.log('Loading a web page');
var page = require('webpage').create();
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
};
page.onError = function(msg, trace) {
var msgStack = ['ERROR: ' + msg];
if (trace && trace.length) {
msgStack.push('TRACE:');
trace.forEach(function(t) {
msgStack.push(' -> ' + t.file + ': ' + t.line + (t.function ? ' (in function "' + t.function + '")' : ''));
});
}
console.error(msgStack.join('\n'));
};
var url = 'phantom-test.html';
page.open(url, function (status) {
//Page is loaded!
phantom.exit();
});
% phantomjs phantom-test.js
Loading a web page
ERROR: TypeError: 'undefined' is not a function (evaluating 'listeners.removeEventListener.bind(listeners)')
TRACE:
-> file:///Users/ogre/Documents/.../tests/lib/winjs/base.js: 760 (in function "resourcesInit")
-> file:///Users/ogre/Documents/.../tests/lib/winjs/base.js: 863
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment