We are evaluating Ranorex at the moment for a new project, and it does look rather good at present!
What I do need to do, however, is to interrogate tree items so as to get their icon or icon index at the very least, specifically in Sql Server management studio.
I've tried everything that I can think of but cannot seem to gain access to this. Does anyone have any ideas?
Regards
Chris
Tree interrogation
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Tree interrogation
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
Re: Tree interrogation
I've not tried specifically on SQL Server Management Studio but here is the process I use to get tree data:
1) Find the tree (using FindSingle)
2) Find the correct container I want to interact with (i.e. the data panel)
3) Get a list of each Tree Item in the continaer and iterate through those Tree Items
4) get a list of each Tree Item cells and interate through those cells
5) You now have access to each cell in the tree that you want to interact with
There is probably a simpler/better way to do this. I wrote this when I was first learning Ranorex and never had the time to go back and make it better, but it serves my purpose for now.
Also, I've left out some of the surrounding code since some of these lines of code are from separate methods and have other reporting information associated with them.
Good luck!
1) Find the tree (using FindSingle)
Code: Select all
Ranorex.Tree RanorexTree = Host.Local.FindSingle(strTreeCostXPath, 30000);
Code: Select all
HDTreeContainer = RanorexTree.FindSingle(".//container[@accessiblename='" + strTreeContainer + "']", 30000);
Code: Select all
IList<Ranorex.TreeItem> ContainerItems = HDTreeContainer.FindChildren<Ranorex.TreeItem>();
foreach (Ranorex.TreeItem Item in ContainerItems)
Code: Select all
IList<Ranorex.Cell> TreeItemCells = Item.FindChildren<Ranorex.Cell>();
foreach (Ranorex.Cell Cell in TreeItemCells)
Code: Select all
string strCell = Cell.ToString();
string strCellText = Cell.Text.ToString();
There is probably a simpler/better way to do this. I wrote this when I was first learning Ranorex and never had the time to go back and make it better, but it serves my purpose for now.
Also, I've left out some of the surrounding code since some of these lines of code are from separate methods and have other reporting information associated with them.
Good luck!
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: Tree interrogation
Hi, Thanks for your reply.
Unfortunately it doesn't work for me. The SSMS tree view is lazy loaded, so when I look at the Cells IList, it has zero entries.
The only way I am able to navigate around the tree is by using the xpaths.
Any other ideas?
Chris
Unfortunately it doesn't work for me. The SSMS tree view is lazy loaded, so when I look at the Cells IList, it has zero entries.

The only way I am able to navigate around the tree is by using the xpaths.
Any other ideas?

Chris
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
Re: Tree interrogation
Try ivoking the expand all function of the tree. My tree is the same. I must expand it so that I can then access it.
Look into using InvokeRemotely from Ranorex to invoke the expand all method of the tree.
Once I know what the TreeList object is, is what I use for my DevExpress Tree Lists:
After I do the expand all I can then iterate the tree items and get the data that I need.
Look into using InvokeRemotely from Ranorex to invoke the expand all method of the tree.
Once I know what the TreeList object is, is what I use for my DevExpress Tree Lists:
Code: Select all
(control as DevExpress.XtraTreeList.TreeList).ExpandAll();
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: Tree interrogation
WOO HOO!! yes, I took the some other example code on the forums (or was it the blog) using InvokeRemotely, and I actually managed to get it to work, returning the Image object 
Actually what I did was use my existing tree handlign code to manipulate the tree down to the object that I was interested in; selected it; then ran the invokeremotely stuff to get the image of the "SelectedNode" of the tree.
Thanks!! The evaluation of Ranorex as our GUI tool of choice is going rather well!

Actually what I did was use my existing tree handlign code to manipulate the tree down to the object that I was interested in; selected it; then ran the invokeremotely stuff to get the image of the "SelectedNode" of the tree.
Thanks!! The evaluation of Ranorex as our GUI tool of choice is going rather well!
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
Re: Tree interrogation
Cool, glad you got it working.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...