Micro Focus QTP (UFT) Forums

Full Version: How to count items in a weblist
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
can you please tell me how can i count listbox items in a weblist using script.
QTP version:9.2
Please give a solution apart for "getitemcount" method .i dont know why but it is not available in my system.
Hi,
Use "All Items" property. (See more of QTP help for more details).
Hi Prachirao,

use GetROProperty("items count")
hi Manish,

thanks for the reply.i already tried using it but am getting a general run error.

pasting the code please look into it
Code:
systemutil.run"http://in.news.yahoo.com/astrology/"
Count =Browser("name:=Astrology - Yahoo! India News").Page("title:=Astrology - Yahoo! India News").WebList("innertext:= All News Yahoo! News Only").GetROProperty("items count")
msgbox count

Thanks,
Prachi
what exactly is the error that you receive?
It must be an object identification issue. add more description to the object like below
Code:
Count =Browser("name:=Astrology - Yahoo! India News").Page("title:=Astrology - Yahoo! India News").WebList("index:=0", "innertext:= All News Yahoo! News Only").GetROProperty("items count")
Prachi -
Add the weblist object to the repository, use it and then see if you still get the error. If you dont then replicate the same property on your DP and see if that helps. If that does, then customize it according to your requirements.
Thanks u solved my problem