I'm trying to catch System.Windows.Automation.ElementNotAvailableException
but when the exception happens, visual studio still throw it. Why and how do I fix this?
I looked up for System.Windows.Automation.ElementNotAvailableException
on Exception Settings (Ctrl + Alt + D + E on VS 2015 commnunity) and that type isn't checked.
The try-catch block look like this:
try
{
appElement = AutomationElement.RootElement.FindFirst(TreeScope.Children, condition);
}
catch(ElementNotAvailableException)
{
appElement = null;
}