Reputation: 28489
I'm using Selenium from python, using web driver with the Chrome backend.
I would like to check at the end of each test test there were no javascript exceptions thrown during the test -- basically the equivalent of opening the JS console and looking for red text. Is there an easy way to do this from selenium? I'm not looking to catch exceptions from any particular javascript call, I'm looking for exceptions thrown by stuff happening in the background which might not usually cause a failure of the test itself.
Upvotes: 1
Views: 1777
Reputation: 1339
Brian Kitchener recently posted on his blog about a way to return errors by injecting some JavaScript into each page. I haven't tried it, and it looks like he might be working with Selenium RC, but I suspect it would adapt to webdriver quickly and might be a good starting point for what you're trying to do.
Upvotes: 1