Micro Focus QTP (UFT) Forums
how to count no of weblist on the page - 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: how to count no of weblist on the page (/Thread-how-to-count-no-of-weblist-on-the-page)

Pages: 1 2


how to count no of weblist on the page - sudhirzpatil - 05-26-2009

Hi I am trying to count total no of weblist on the web page.
But i am geting error.
The script i have is

Code:
Systemutil.Run"IExplore","http://www.google.co.in"
wait(1)
Dim obj_DescChk
Set obj_DescChk=Description.Create
obj_DescChk("html tag").value="select"
obj_DescChk("ClassName").value="weblist"
Browser("title:=Google").Page("title:=Google").link("innerhtml:=Preferences").Click
Dim AllChkBoxes
Set AllChkBoxes=Browser("title:=Preferences").Page("title:=Preferences").ChildObjects(obj_DescChk)
msgbox AllChkBoxes.count

Can anybody correct the error


RE: how to count no of weblist on the page - sreekanth chilam - 05-26-2009

Hi ,

Try with the below code.

Code:
Systemutil.Run"IExplore","http://www.google.co.in"
wait(1)
Dim obj_DescChk
Set obj_DescChk=Description.Create
obj_DescChk("Micclass").value="WebList"
Browser("title:=Google").Page("title:=Google").link("innerhtml:=Preferences").Click
Dim AllChkBoxes
Set AllChkBoxes=Browser("title:=Preferences").Page("title:=Preferences").ChildObjects(obj_DescChk)
msgbox AllChkBoxes.count



RE: how to count no of weblist on the page - sudhirzpatil - 05-27-2009

Still I am getting following error.

The test run cannot continue due to an unrecoverable error.

General run error.

Line (8):
Code:
"Set AllChkBoxes=Browser("title:=Preferences").Page("title:=Preferences").ChildObjects(obj_DescChk)".



RE: how to count no of weblist on the page - sreekanth chilam - 05-27-2009

Hi ,

Just keep some syncronization points(wait,exist,waitproperty) after the given below statement (such as):

way1:

Code:
Browser("title:=Google").Page("title:=Google").link("innerhtml:=Preferences").Click
wait(3)
Dim AllChkBoxes
Set AllChkBoxes=Browser("title:=Preferences").Page("title:=Preferences").ChildObjects(obj_DescChk)
msgbox AllChkBoxes.count



way2:

Code:
Browser("title:=Google").Page("title:=Google").link("innerhtml:=Preferences").Click
if Browser("title:=Preferences").Page("title:=Preferences").exist then
   Dim AllChkBoxes
Set AllChkBoxes=Browser("title:=Preferences").Page("title:=Preferences").ChildObjects(obj_DescChk)
msgbox AllChkBoxes.count
End if

way3:

Code:
Browser("title:=Google").Page("title:=Google").link("innerhtml:=Preferences").Click
Browser("title:=Preferences").Page("title:=Preferences").waitProperty "Visible",True,"20000"
Dim AllChkBoxes
Set AllChkBoxes=Browser("title:=Preferences").Page("title:=Preferences").ChildObjects(obj_DescChk)
msgbox AllChkBoxes.count



RE: how to count no of weblist on the page - sudhirzpatil - 05-28-2009

No Sreekanth , It sstill gives same error.


RE: how to count no of weblist on the page - guocnc - 06-09-2009

Code:
change obj_DescChk("Micclass").value="WebList" to be obj_DescChk("micclass").value="WebList"



RE: how to count no of weblist on the page - Bijju - 06-18-2009

Use micclass instead of Class Name
by the way, r u looking for chkboxs or for weblists !!!


RE: how to count no of weblist on the page - QTPgrd - 07-06-2009

Hi

Try the below script....It would fetch the checkbox count

Code:
Browser("Google").Page("Google").Link("Preferences").Click
Set obj_ChkDesc = Description.Create
obj_ChkDesc("html tag").value = "INPUT"
obj_ChkDesc("type").value = "checkbox"
Set AllChkBoxes = Browser("Google").Page("Google").ChildObjects(obj_ChkDesc)
msgbox AllChkBoxes.count

Thanks


RE: how to count no of weblist on the page - sarveshqtp - 07-06-2009

General run error. is coming on execution


RE: how to count no of weblist on the page - QTPian - 07-07-2009

Hi sarveshqtp,
The script posted by QTPgrd is working for me.. If possible, can you please post your script you are using? so that I may try to identify the error.
Thanks,