17

After tests are run, I want to collect all console error messages displayed in the console(Open Firebug -> Click on Console -> Click on Errors) using Selenium WebDriver + Java.

I tried the answer mentioned here, but it only displays messages for 'Warnings', 'Info' but not for 'Errors'

I want only Console errors like -

Console log

Can someone please help me how to get those Console log?

11

Use JSErrorCollector, to collect javascript errors (those coming up in the console) from firefox through java.

it gets as simple as this,

final List<JavaScriptError> jsErrors = JavaScriptError.readErrors(driver); 
| improve this answer | |
  • Thank you Deepak, for answer and most importantly pointing to JsErrorCollector git repo!!! – Alpha Dec 1 '14 at 11:36
  • @deepak I am getting error for this package import and whereever JavaScriptError is used in my code, I've added jar file to my project as well import net.jsourcerer.webdriver.jserrorcollector.JavaScriptError; – Hassan Jun 23 '16 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.