Created
August 14, 2012 22:06
-
-
Save catherinemarvin/3353425 to your computer and use it in GitHub Desktop.
lololol
This file contains hidden or 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
//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