Count & Print all links from a webpage



'========================================================================
'Description: This function will print the number of links from any webpage
'========================================================================

Option Explicit

'Define variables
Dim lnk,colLink,lnkCounter,var

'Create the description object for links
Set lnk=Description.Create()
lnk("micClass").value="Link"
lnk("html tag").value="A"

'Get all the  Link objects from the page
Set colLink =Browser("CreationTime:=0").Page("micClass:=Page").ChildObjects(lnk)
For lnkCounter=0 to colLink.count-1
print colLink(lnkCounter).getroproperty("text")   ' print the link names
Next

'Release objects
Set colLink=Nothing

'Output from Google webpage "http://www.google.co.in/"

Comments

Post a Comment

Popular posts from this blog

Test Batch Runner - Run QTP Scripts from xls file

Selenium: db and excel data into maps

Python: get entire workbook data cell by cell