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 ??
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.GetItemsCountAllItems = 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 NEXTI hope this offers a suitable solution,
Hello Michael,
we have qtp 8.2 and test advantage related to net advantage (which developers are using)
I have a treeview control mentioned above in your reply, I tried the same way you have described before searching online for solution, it did not work for my case. I found you answer and tried again, no result. It just does nothing on the grid but loops till item count.
iCount = SwfWindow("EDIMS Main Grid").SwfWindow("Patient Chart -- Orders").SwfTreeView("utOrderMasters").GetItemsCountFor i=0 to iCount -1 nItem = SwfWindow("EDIMS Main Grid").SwfWindow("Patient Chart -- Orders").SwfTreeView("utOrderMasters").GetItem(i) pItem = "\" & nitem '''since while recording, QTP recorded the item as .CheckNode "\myitem"
SwfWindow("Main Grid").SwfWindow("Orders").SwfTreeView("utOrderMasters").ActivateNode pItem
Exit forNext
Since I cannot hardcode the name as it may change, I need to select any one node or first or second.
can you please look into my issue and help me?
Hi Srinivas
Try using this loop instead of the one you are currently using:
For i=0 to iCount -1
' Get the Node key nItemKey = SwfWindow("EDIMS Main Grid").SwfWindow("Patient Chart -- Orders").SwfTreeView("utOrderMasters").GetNAProperty("Nodes["+ i +"].Key"
SwfWindow("Main Grid").SwfWindow("Orders").SwfTreeView("utOrderMasters").ActivateNode nItemKey
Hope that will work.
Regards,
Ammar
Hey Ammar,
Thank you for bringing out the solution. However here is a intersting situation i am facing.
I am trying to retrieve the key value and here is what i am doing,
Set Tree=Browser().page().frame().swfobject().swftreeview("TREE")
ccount=Tree.GetItemsCount
for i= 0 to ccount-1
nitemkey=Tree.GetNAProperty("Nodes["+ i +"].Key")
I get the error message as,
Type Mismatch: '[String: "Nodes["]'
Can you please take a look at the issue ???
Ammar,
Never mind. I got through. Had to use "& i &".
Had another quick question. How do i retireve the childnodes within the nodes using the same method ??