Suppose we want to find total number of
links in a web page or in a web table.
We can use Descriptive Programming with
ChildObect method to do this.
1. Total number of Links on a Webpage with their name:
Dim ObjLinks, ObjChild,intCount
Set ObjLinks = Description.Create
ObjLinks("micclass").Value =
"Link"
Set ObjChild =
Browser("Name:=Page").Page("Title:=Page").ChildObjects(ObjLinks)
MsgBox ObjChild.Count
For intCount = 0 To ObjChild.Count-1
LinkName=
ObjChild(intCount).GetROProperty("Name")
MsgBox
LinkName
Next
2. Total number of Links on a Webtable with their name:
Dim ObjLinks, ObjChild,intCount
Set ObjLinks = Description.Create
ObjLinks("micclass").Value = "Link"
Set ObjChild = Browser("Name:=Page").Page("Title:=Page").Webtable("Name:=WebTable").ChildObjects(ObjLinks)
MsgBox ObjChild.Count
For intCount = 0 To ObjChild.Count-1
LinkName=
ObjChild(intCount).GetROProperty("Name")
MsgBox LinkName
Next
No comments:
Post a Comment