Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - How can we count the list box elements in QTP ?

asked marvit August 19, 2014 12:44 AM  

How can we count the list box elements in QTP ?


1 Answers

answered By Dharma   0  
This sample script uses mercury Flight Reservation site & count number of items in list box "From Day" & display their name one by one.

SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe", ""
  Dim list_count
  Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "test"
  Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure "4cb4513bfbdc1da7fa533425cf4f"
  Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click
  list_count=Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebList("fromDay").getroproperty("items count")
  msgbox list_count
  For i = 1 to list_count
  Item_Name = Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebList("fromDay").getitem(i)
  msgbox Item_Name

   add comment

Your answer

Join with account you already have



Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!