title: How can I intercept Selenium errors?
body: <p>In developing Selenium extensions I have scripting to verify the correct handling of failure cases. Unfortunately, I have to execute those commands one-by-one in the IDE, and manually examine each error message. What I would like to do is define a custom Selenium command that I can insert before each command that intentionally fails in a given way. Eg: willFail|expected-error-text.</p>
  
  <p>In other words, I want to alter Selenium command completion behavior such that if the next command throws the given error message, then the result is success and the script continues. But if it succeeds or throws a different error, then the script stops with an error.</p>
  
  <p>I imagine this will involve setting observer function(s), and/or intercepting Selenium function(s). I'd expect the issues to be:</p>
  
  <ul>
  <li>How/where to do the initialization. The relevant Selenium objects can be hard to find.</li>
  <li>What/when to return in order to alter the result.</li>
  <li>Is there something else left out-of-sync by altering a result?</li>
  </ul>
  
  <p><em>The PowerDebugger extension allows you to pause the IDE upon a failure, and then resume. So I suspect that the how-to is in there somewhere. But I can't quite figure out how it hooks into Selenium command processing. Samit Badle, are you out there?</em></p>
  
  <p>I am using Selenium IDE 2.2.0.</p>