Skip to content

Instantly share code, notes, and snippets.

@catherinemarvin
Created August 14, 2012 22:06
Show Gist options
  • Save catherinemarvin/3353425 to your computer and use it in GitHub Desktop.
Save catherinemarvin/3353425 to your computer and use it in GitHub Desktop.
lololol
//this code console.logs the errors that arise from failing the spec
for (var i = 0; i < list.length; i++) {
var item = list[i];
console.log("");
var description = item.querySelector(".description").innerText;
var resultMessage = item.querySelector(".resultMessage").innerText;
console.log("{ \"errorType\" : \"failedSpec\", \"description\" : \" " + description + "\", \"resultMessage\": \"" + resultMessage + "\" }");
}
//this code routes console.log() calls from the page context to the phantom context.
page.onConsoleMessage = function(msg) {
console.log(msg);
try {
var toWrite = JSON.parse(msg);
fs.write("test.log",msg,"a");
} catch (e) {
return;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment