1

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

You specifically said Chrome, so I didn't put this in my answer, but if running in Firefox is a possibility, you may also want to check out the NetExport and ConsoleExport Firebug extensions. Through including them in the profile Selenium uses, you may be able to auto-export errors out to files in your run - we do that with NetExport, but I haven't tried ConsoleExport yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.