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 ??
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 ??
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 ???
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
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?
Mike,
I must thank you profusely for the help you offered. As a starter these helps make me feel that someone is always there. Your piece of code and adivse helped me automate several scripts.
Once again thank you for your time.
Warm Regards,
Robert