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
315
how to obtain Key value from SwfTreeView
posted

Hello,

         I am using QTP 9.2 with Infragistics TestAdvantage 2006 vol1 CLR 2.0. The object i am trying to work on is swftreeview. I am trying to click on a particular node on the tree. Here is the code i am using,

count=Browser("xyz").page("xyz").frame("xyz").swfobject("xyz").swftreeview("Xyz").getitemscount

for i= 0 to count-1

item_name=Browser("xyz").page("xyz").frame("xyz").swfobject("xyz").swftreeview("Xyz").getitem(i)

 If item_name = "Checked name"

count=Browser("xyz").page("xyz").frame("xyz").swfobject("xyz").swftreeview("Xyz").ActivateNode(i)

End if

Next

Whenever i run the code i get the error,  " No Node with Key:0 "

Can anyone please take a look at it and let me know how to obtain the keyid for the particular node ??

 

 

 

Parents
No Data
Reply
  • 7695
    Offline posted

     Hi Robert,

        For starters, while it has in some limited scenarios been made to mostly work, it must be stated that we do not support our NetAdvantage Windows Forms controls and their related TestAdvantage proxies in a web enviroment, as it appears that is what you are doing with your sample.

        That being said I am assuming you have been able to get the controls to work for your purposes, and the error that you hit is not related to the web environment. ActivateNode takes in one of two possibilities for a parameter, that would be the Nodes key or the text path to the node. What you are passing in is numeric index to the visible location of the node. If you have or know the key, you can pass that in directly, either that or you need to get the path. To get all of the paths in the same order as it is in the GetItemsCount you can use the GetContent method. Here is an example of how to activate a node with a specific value in the text by looping through all the nodes, similar to how you suggested doing it.

    SET tree = SwfWindow("UltraTree Cell Editing").SwfTreeView("treeNavigator")

    itemCount = tree.GetItemsCount
    AllItems = SPLIT(tree.GetContent, VBLF)
    MyItem = "TextContentForMyNode"

    FOR i = 0 TO itemCount - 1
        item_name=SwfWindow("UltraTree Cell Editing").SwfTreeView("treeNavigator").GetItem(i)
        IF item_name = MyItem THEN
            tree.ActivateNode(AllItems(i))
        END IF   
    NEXT

    I hope this offers a suitable solution, 

Children