Click on a TreeItem not uniquely identified - Problem

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Click on a TreeItem not uniquely identified - Problem

Postby snj_tm » Mon Sep 15, 2008 5:06 am

Hello,

I have a problem with clicking on a TreeItem which is not uniquely identifed by its name.

We have something like this: A tree which has certain final nodes with the same name. E.g.:
rootNode/node
rootNode/node
...
rootNode/node
When clicking on a certain node inside the tree, another view of the application(properties view) displays info about the node.

In order to access(to click) a particular node (e.g the third) I tried something like this:

final IWidgetLocator[] findAll = ui.findAll(new TreeItemLocator("rootNode/node",new SWTWidgetLocator(Tree.class, new SWTWidgetLocator (ViewForm.class))));
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
ui.click(findAll[2]);

}
}

catch (Exception e) {
e.printStackTrace();
}
}
});

Even though, at playback, it's the first item that is clicked -> I cannot acces the info associated with any other node but the first.
Can you help me with this?

Thanks a lot.
snj_tm
 
Posts: 3
Joined: Thu Mar 20, 2008 1:15 am

Re: Click on a TreeItem not uniquely identified - Problem

Postby Phil Quitslund » Tue Sep 23, 2008 7:48 pm

Are you still blocked on this?

At first blush, I would expect your snippet to work -- although I would omit the sync exec:

Code: Select all
IWidgetLocator[] allNodes = ui.findAll(new TreeItemLocator("rootNode/node",new SWTWidgetLocator(Tree.class, new SWTWidgetLocator (ViewForm.class))));
ui.click(allNodes[2]);


Let us know and we'll investigate.

Thanks!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest