Count the number of links & Objects in a web page by ChildObjects Method

Share This Post -

To count the number of links in a web page, We can use ChildObjects to get the link collection, then retrieve the properties for example number of links or any other objects on page.

 

Dim oDesc, oAllLinks, iNumberOfLinks
set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set oAllLinks = Browser("creationtime:=0").
Page("micclass:=Page").ChildObjects(oDesc)
iNumberOfLinks = aAllLinks.Count
msgbox iNumberOfLinks