Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
142
How to get the selected node(s) of an ultratree?
posted

I have an ultratree object, and I am wondering how do I find/get the selected node(s)/path?

I can't find any getSelectedNode or anything with "select" in it. There is getChildNodes and such, but nothing that seems to be unique to the selected node(s)/path that I can see off-hand.

Nor do I know where there is more documentations on TestAdvantage object/proxy save here.

Thanks ahead of time for your help.

 

PS: the ultratree contains nodes which when clicked, takes me to various pages/locations within the AUT. I need to know where I currently am (selected node(s)) and go to a given node(s)/path. The second part I got, it's the first I don't know.

 

Parents
No Data
Reply
  • 6729
    Verified Answer
    Offline posted

    Hi Shaule,

    The tree proxy has a verification point that return the Active Node hierarchy as a TestDataTree object. you can use the following code to loop through the TestDataTree node and calculating the node path:

    Dim data As Vp.Impl.TestDataTree = MainTreeTree.GetTestData("selected node hierarchy")
    'GetRoot node from the hierarchy
    Dim node As Vp.Impl.TestDataTreeNode = data.GetTreeNodes().GetRootNodes()(0)
    Dim path As String = node.GetNode().ToString()
    While node.GetChildCount() > 0
     node = node.GetChildren()(0)
        path = path + "/" + node.GetNode().ToString()
    End While
    LogInfo("Selected NodePath = " + path)

    'if you use "->" as delimiter instead of "/" then you could use the path to click on the node

     MainTreeTree().Click(AtPath(path))

     

    I hope this will help you.

     

    Let me know if you have any further question and remember to verify this answer if it worked for you so that others can benefit from it

Children