I have many test cases written in C# using Selenium2 Webdriver with NUnit. I have a problem that when a NoSuchElementException is thrown, it is treated as an unhandled exception despite me using a catch block.
An example:
try
{
element = driver.FindElement(By.Id("ELEMENT_ID"));
}
catch (NoSuchElementException)
{
// Handle exception...
}
I don't understand why this is giving me the error "NoSucElementException was unhandled by user code." I must be doing something wrong but I can't see what...