I'm testing with Selenium webdriver using C#. How can I log all JavaScript errors that could happen through my tests?
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With