- Code: Select all
//open the dialog
...
//create the expected String list
...
while(list.hasNext){
//get expected text from the list
...
try{
//create locator
WidgetLocator myLocator = new SWTWidgetLocator(Label.class, expectedText);
ui.find(myLocator);
System.out.println("Found widget: "+ expectedText);
}
catch(WidgetSearchException e){
System.out.println("Cannot find widget: "+ expectedText);
}
}
It works properly when the dialog has the expected labels, but if an expected label does not exist, the dialog is closed after the WidgetSearchException expection occurs. As a result, the rest of the labels cannot be checked. I would like to know why the dialog is closed when the find method throws an exception.
Thanks.