Has anyone an example how to click not-unique JButtons.
In my test I need to click at least one of two not-unique JButtons. Not-unique means Names are the same, Labels are the same and even the position is the same. The last is due to the fact that they are on different pannels which are on top of eache other.
I don't mind which button would be clicked first.
IWidgetLocator[] frameCloseButtons = ui.findAll(new NamedWidgetLocator(".*_frame_Close")); // The mentioned buttons are named this way
numberofCloseButtons = frameCloseButtons.length;
for (int i=0; i<numberofCloseButtons; i++)
{
try
{
String TString = frameCloseButtons[i].toString();
System.out.println(TString);
if (!TString.contains(",disabled,"))
{
JButtonLocator nwl = (JButtonLocator)frameCloseButtons[i]; // WidgetReference cannot be cast to JButtonLocator (here is my error)
ui.click(nwl);
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
Regards,
Marc Jagt