A list of articles as leads on how to accomplish this:
I also found the code below (here: http://www.silverwareconsulting.com/index.cfm/2010/6/7/Checking-for-Java...)
I've recently been writing some end-to-end tests for ValidateThis, my validation framework for ColdFusion objects, using Selenium. One of the things I wanted to test were the client-side validations that the framework generates automatically. Selenium makes it very easy to test these, as I can use Selenium's assertText command to locate failure messages that have been generated by the jQuery Validation plugin, using XPath, and check whether the message is what I expected.
I simply add a script to my page that will catch any JS errors by intercepting the window.onerror event: