How to Click on a Tree Item in a Cell using windowTester?

295 Views Asked by At

I have a shell in which there is a tree inside a Composite. I want to click on a particular cell of the tree. When I try to record the Actions, it is not giving the proper recordings, so I want to do it manually.

Please see the snapshot attached and the location where I want to click for example.

This is the Error coming after recording

WARNING: unsupported widget selection ignored - Widget Selection event: null

Please help me as I am not good with Eclipse and it's kind of important for our project. Thanks a lot.

enter image description here

1

There are 1 best solutions below

0
On

You can do this manually in your test code by writing:

// first click on the item to ensure it is visible in the scrolled view
TreeItemLocator itemLocator = new TreeItemLocator("/tree/path/to/File");
getUI().click(itemLocator);

// then you can access the tree cell (columns are zero-based
TreeItemLocator cellLocator = SWTLocators.treeCell(itemLocator.getPath())).at(SWTLocators.column(4);
getUI().click(cellLocator);

Of course, you could import static com.windowtester.runtime.swt.locator.SWTLocators.* to make the code more readable.