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
how to get the child and subchild elements from the swftreeview(gridtree)


I had a scenario to automate a script where i need to get the child items to be selected from the swftreeview, which is of gridtree,

For example  Java is the root tree and in that j22e, veriosn of java, version of J2ee these are the child elements of the Jave i need to get the version of java now that is the child element of java in the save way i need to get the grandchild elements also.Please try to help me regarding this, It would be very great to share with me if you have any idea regarding this. Please let me know so that i can go ahead with this

Its very urgent, Please try to help me out




No Data
  • 7695
    Offline posted

    Hi Srikanth,

        What you are asking is possible, although it will take a bit of work to build the specifics of what you want to acheive. Below are a few of the basic functions that TestAdvantage and QuickTest Professional have that will assist you in doing what you want to do.

    ' To make this more ledgable I am going to assume the following
    Set tree = SwfWindow("Form1").SwfTreeView("ultraTree1")

    TestAdvantage Functions :

    • tree.GetContent() - returns a chr(10) delimited string list of all the currently visible nodes, and their children if they are expanded
    • tree.Expand(strNode) - expands just the supplied.
    • tree.ExpandAll(strNode) - expands the supplied node and all the nodes under the supplied node.

    QuickTest Professional Functions :

    • Split(string, delimiter) - returns an Array of strings split by the delimiter
    • UBound(array) - returns an integer value of the UpperBound of an array
    • Len(string) - returns an integer value of the number of characters in the string
    • Mid(string, start, length) - returns a string value substring of the supplied string starting from the start position of a length of characters supplied.

    You could use GetContent() to get all the currently visible nodes. You can then Split that list into an Array, loop through them, and Call ExpandAll on all the visible nodes, and you will have all possible nodes visible. Call GetContent() again, then you will get a list of all of the nodes.

    If you want to handle the individual tier nodes in order, you can just either just expand the parent, or use something like:
    IF parentNode = Mid(currentNode, 0, Len(parentNode))
    to determine if the node you are currently testing is a child of the parent node. There are a number of approaches based on what you might want to do. But hopefully the functions supplied will help you with what you need to do.