QTP/UFT Support Tip: How to expand all nodes in a JavaTree programmatically?
The JavaTree object in QTP/UFT does not have a built in method to expand all nodes at once, in case it is necessary to expand all node in a Java tree. The following code can be used to expand all nodes from a JavaTree starting from the root:
Set jtree = JavaWindow("javawindow").JavaTree("javatree")
i = 0
itm = jtree.GetItem(i)
i = i+1
allNodes = jtree.GetROProperty("items count")
Loop Until CInt(i) = CInt(allNodes)
To use the code it is only necessary to change the first line to reflect the correct Java objects for identification based on the application under test.
Note: The above code is not part of QTP/UFT and is provided as-is without guarantee that it will work in every situation, thus HP is not responsible for supporting it or any modifications it may need to suit specific requirements.
[If this post or any other post helps to resolve your issue or query, mark the thread as solved and give KUDOS to the author for their assistance. ]
(Posts and opinions made here are my own and do not reflect the opinions of my employer HP in any way)