Micro Focus QTP (UFT) Forums
Count gives wrong result - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Count gives wrong result (/Thread-Count-gives-wrong-result)



Count gives wrong result - sudhirzpatil - 05-27-2009

Hi I am trying to count total no of weblist from the web page.
I have written following script.
But it gives result as 0.However there are 2 weblist present on the page.
Why it showing result as 0 ?

Code:
SystemUtil.Run"IEXPLORE.exe","http://www.google.com"
Set Butobj = Description.Create()'Forweblist
Butobj("micclass").value = "weblist"'For weblist
Butobj("html tag").value="select"'For weblist
Browser("name:=google").page("title:=google").link("innerhtml:=preferences").click
set collection=browser("name:=preferences").page("title:=preferences").childobjects(Butobj)
msgbox collection.count

Can anybody point the mistake ?


RE: Count gives wrong result - Tarik Sheth - 05-28-2009

Hi,

Replace following
1.
Code:
Butobj("micclass").value = "weblist" WITH  Butobj("micclass").value = "WebList"
2.
Code:
Butobj("html tag").value="select" WITH  Butobj("html tag").value="SELECT"

Now it is giving count as '2'


RE: Count gives wrong result - sudhirzpatil - 05-28-2009

Thanks a lot tariksheth. Its giving proper result now.