I’m testing with Selenium webdriver using C#.
How can I log all JavaScript errors that could happen through my tests?
I’m testing with Selenium webdriver using C#. How can I log all JavaScript errors
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That depends what you mean, if you want to capture javascript errors generated in your code when you use:
((IJavaScriptExecutor)_driver).ExecuteScript("some javascript code here")Then just wrap those statements in a try/catch/finally and log the exception.
If you want to capture javascript errors generated by the browser, then the short answer is: you can’t easily do so.
The long answer:
SetPreference()so that it will automatically export the console to a location of your choiceIf you need some sample code, let me know and I’ll give you the really long answer…