Hi -
I am getting an error when trying to expand a node using the index in an object identified as SwfTreeView by QTP (Infragistics.Win.UltraWinTree.UltraTree).
QTP complains that the node with index 0 does not exist. However, the .GetItem(0) does return the text of the node with index 0.
The syntax of the call is -
SwfWindow("Window").SwfTreeView("Tree").ExpandAll 0
Any ideas as to what am I doing wrong?
Primarily because ExpandAll and most TestAdvantage UltraWinTree actions do not use integer indexes as their arguments, they use either the Node Key, or a NodeTextPath. It identifies the difference between the Key and the NodeTextPath, by the NodeTextPath will start with and is delimited by a double slash "\\" between each NodeLevel. You mentioned you were able to get the Text, if so, use that prefixed with "\\" and it should work. Either that if you were able to get the Text, you could also instead get the Key, and that would work as well.
Let me know if that works for you,
Thanks. That helps.
I have a different question about the same treeview object, if you don't mind answering.
I am trying to check if a particular node has been expanded or not.
I am using .GetItemProperty(item,"expanded") for this purpose, but QTP throws an error saying that this property does not exist. Is there an alternate way of getting this information. I tried looking through the help but did not find anything.
Hi,
GetItemProperty, retrieves the .NET property for the Node, the key here is the .NET property which .NET is case-sensitive. The reason for the exception is because the property is "Expanded", not "expanded". A standard rule of thumb is most .NET public property names, will typically be CamelCase.
Hope that answers your question,
Thanks! That worked. Much appreciated.