I have some code where an expected exception is not being caught. I'm trying to find an element which most of the time will be stale. So I loop 60 times attempting to get the element before I get a element not found exception. It doesn't print out that it caught the exception even though I still get a stale element exception.
public static WebElement DropDown(WebDriver driver) throws InterruptedException
{
    WebElement element = null;
    for (int i = 0; i < 60; i++)
    {
        try
        {
            element = driver.findElement(By.cssSelector("html body div.navbar.navbar-inverse.main-navbar "));
            break;
        }
        catch (org.openqa.selenium.StaleElementReferenceException e)
        {
            System.out.println("Caught an Staleelement exception");
        }
        Thread.sleep(1000);
    }
    return element;
}
 
     
     
    