How to get the count of links, images, buttons and edits in a web page using QTP
Function GetAllSpecificControls(Page, MicClass) Set Desc = Description.Create()
Posted by Kanikaram Kiranpaul 99 comments
How to get the count of drop down values in QTP
Write a Script to get the count of the drop down items and then print the drop down values in an excel sheet from QTP.
Before running the script in QTP the user needs to add the dropdown box in the Object repository. Here we are using excel application object so that QTP creates and excel application. We are setting the excel application to be visible so that during run time we can see exactly whats happening. GetROProperty Item Count actaully counts the total number of items in the drop down during run time. Once this count is received we will pass them in a loop so that we can pass them to the excel sheet to be added one by one. msgbox is kept in the loop just to see that each item is being retreived.
'Initializing an array with 3 columns and 4 rows
Dim Eobj Set Eobj= createobject ("Excel.Application")
Eobj.visible = true
Eobj.workbooks.add
Set obj = description.Create()
obj= Browser("Browser").Page("Page").Frame("Frame").WebList("city").GetROProperty("Items Count")
For i=1 to obj
obj2= Browser("Browser").Page("Page").Frame("Frame").WebList("city").GetItem(i)
Msgbox obj2
Eobj.cells(i,1).value = obj2
Next
Eobj.Activeworkbook.Saveas("c:\citylist.xls")
Eobj.quit
Posted by Kanikaram Kiranpaul 118 comments
Subscribe to:
Posts (Atom)