- Code: Select all
ui.click(new JButtonLocator(""));
But when I run the test it fails at the point it should click the Home button with:
- Code: Select all
com.windowtester.runtime.MultipleWidgetsFoundException: Multiple Components found
My attempted solution to this problem is to disambiguate like so:
- Code: Select all
ui.click(new JButtonLocator("", 0, new SwingWidgetLocator(JPanel.class)));
This at least lets me click a button, but it's the "Parent Directory" button. The only index that works is 0. Any other index (I've tried 1 through 10) produces a WidgetNotFoundException:
- Code: Select all
com.windowtester.runtime.WidgetNotFoundException: Component not found JButtonLocator("", 1, WidgetLocator(javax.swing.JPanel)):
If this were an SWT app, I could use the handy com.windowtester.runtime.swt.util.DebugHelper to print the widget hierarchy. There is no equivalent helper for Swing as far as I can tell, so I used Swing Explorer [2]. The highlighted JButton is the one I'm trying to click:
It looks like index 2 would be what I wanted (or maybe 1 if you interpret the semantics of index i to mean the ith JButton, and not just the ith child). Certainly some index between 1 and 7 should do the trick.
So what do I have to do to click the "Home" button?
Thanks.
-David
[1] http://download.oracle.com/javase/tutor ... ooserM.png
[2] http://www.swingexplorer.com/