Saturday, December 6, 2008

To Know the No of Items in the Web Page

url="http://my.naukri.com/manager/createacc2.php?othersrcp=5421&wExp=N"
'url="www.gmail.com"
'url="www.yahoomail.com"

If Browser("index:=0").Exist(1) then' If Browser is already opened
a = Browser("index:=0").GetROProperty("hwnd")
Browser("hwnd:=" & a).Navigate(url)
Browser("hwnd:=" & a).Sync
wait(2)
Else' If Browser is not opened
SystemUtil.Run"IEXPLORE.exe"
a = Browser("index:=0").GetROProperty("hwnd")
Browser("hwnd:=" & a).Navigate(url)
Browser("hwnd:=" & a).Sync
wait(2)
End If

Set Editobj=Description.Create'For WebEdits
Editobj("html tag").value="INPUT"
Editobj("kind").value="singleline"

Set Butobj = Description.Create'For Buttons
Butobj("html tag").value = "INPUT"
Butobj("type").value="submit"

Set Listobj=Description.Create'For Web Lists
Listobj("html tag").value="SELECT"

Set Linkobj=Description.Create'For Link
Linkobj("html tag").value="A"

Set Checkboxobj=Description.Create'For Checkboxes
Checkboxobj("html tag").value="INPUT"
Checkboxobj("type").value="checkbox"

Set Radioobj=Description.Create'For Radio Buttons
Radioobj("html tag").value="INPUT"
Radioobj("html id").value="ctctype_i"


Set Edits = browser("hwnd:=" &a).Page("title:=.*").ChildObjects(Editobj)
Set Buttons = browser("hwnd:=" &a).Page("title:=.*").ChildObjects(Butobj)
Set Lists = browser("hwnd:=" &a).Page("title:=.*").ChildObjects(Listobj)
Set Links = browser("hwnd:=" &a).Page("title:=.*").ChildObjects(Linkobj)
Set Checks = browser("hwnd:=" &a).Page("title:=.*").ChildObjects(Checkboxobj)
Set Radios = browser("hwnd:=" &a).Page("title:=.*").ChildObjects(Radioobj)

msgbox "Total EditBoxes are : "&Edits.count
msgbox "Total Button are : "&Buttons.count
msgbox "Total Lists are : "&Lists.count
msgbox "Total Links are : "&Links.count
msgbox "Total checkBoxes are : "&Checks.count
msgbox "Total RadioButtons are : "&Radios.count

2 comments:

Venkat said...

Hi, I think Index will not work for browser and equivalent identifier for browser is CReation time.

Please confirm that

RAJAPUTRA said...

Venkat,

Index will work for browsers too.
pleae try and see.

About Me

My photo
Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.

Subscribe to get updates on this blog

Enter your email address:

NOTE

Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.