Hi,
we are creating automated tests targetting a windows forms-application which uses only standard Winforms-Controls of VS2008.
But it will be localized in various languages. Our problem is now to create tests that will be running on different language versions.
To target Controls like e.g. Buttons and textboxes, we can use their Controlname, which is fine.
But: Treeview-Nodes are no controls in VS2008, so they have no Controlname at all.
Ranorex TreeItem-Adapter addresses the nodes directly using the displayed Text - which is no option in our case because it is altered in different languages.
Is there a way to overcome our problem, eventually by effecting and misusing something like the AccessibleDescription (a problem is: we can not change Treenode-AccessibleValues in VS2008)?
best Regards
Hannes Mühlenberg
Localization Independent Automation of a TreeView
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
We are currently planning to add better support for the .NET tree / listview classes. For now I can offer a workaround, which might be slow if you have many nodes:
The downside is that you have to do this for every "candidate" node.
Another way is to use treeViewControl.InvokeRemotely(), walking through the nodes and looking for the right name, and then returning the right TreeNode (which is faster, but needs more code).
For an example of how to use InvokeRemotely() please have a look at:
http://www.ranorex.com/blog/transfering ... et-control
Michael
Ranorex Team
Code: Select all
TreeItem someTreeItem = .. some tree item ..
Control treeViewControl = .. your treeview control ...
System.Windows.Forms.TreeNode node = treeViewControl.InvokeMethod(
"GetNodeAt",
new object[] { someTreeItem.Element.ClientRectangle.Location + new Size(1, 1) })
as System.Windows.Forms.TreeNode;
The downside is that you have to do this for every "candidate" node.
Another way is to use treeViewControl.InvokeRemotely(), walking through the nodes and looking for the right name, and then returning the right TreeNode (which is faster, but needs more code).
For an example of how to use InvokeRemotely() please have a look at:
http://www.ranorex.com/blog/transfering ... et-control
Michael
Ranorex Team
Re: Localization Independent Automation of a TreeView
Is there a better solution right now ?
Whats the downside of setting Node.Accessiblity.Name to a fix Value ?
I'm using an Infragistics UltraTree
Whats the downside of setting Node.Accessiblity.Name to a fix Value ?
I'm using an Infragistics UltraTree
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Localization Independent Automation of a TreeView
Ranorex gets the text of .NET treeview items from its Accessible.Name attribute; i.e. the Accessible.Name and the TreeItem.Text attributes of .NET treeview items are the same. Consequently, if you set the Node.Accessibility.Name of the tree item to a fixed value, I guess that Ranorex will always report that fixed value as the TreeItem.Text attribute.
If you need to have a language independent identifier for a tree node, you should better use another property of the Node.Accessibility object, one that you would normally not use, e.g. "Help", "Description", "HelpTopic", or "KeyboardShortcut". I don't know which of these properties you can set on a Infragistics UltraTree node.
Regards,
Alex
Ranorex Support Team
If you need to have a language independent identifier for a tree node, you should better use another property of the Node.Accessibility object, one that you would normally not use, e.g. "Help", "Description", "HelpTopic", or "KeyboardShortcut". I don't know which of these properties you can set on a Infragistics UltraTree node.
Regards,
Alex
Ranorex Support Team