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:

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

    Please confirm that

    ReplyDelete
  2. Venkat,

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

    ReplyDelete