We need to use the ChildObjects method to get the collection of links. Using the collection object we can then retrieve the name and URL properties of every link.
Step by Step illustration:
1) Using the ChildObjects method, get all the links on the webpage.
2) We now have the collection object ready.
3) Use the GetROProperty method to retrieve the required property values. (In our case Innertext & href)
' This can be used on any page Set oLinkDesc = Description.Create() ' Retrieve HTML tag "A" oLinkDesc("html tag").Value = "A" ' Create the collection object Set nLinksCollection = Browser("title:=.*").Page("title:=.*").ChildObjects(oLinkDesc) nLinksCount = nLinksCollection.Count() ' Retrieve all the requied properties For i=0 to nLinksCount-1 sName = nLinksCollection(i).GetROProperty("innertext") sHref = nLinksCollection(i).GetROProperty("href") ' Saving the results in the reporter Reporter.ReportEvent 0, "Links name: " & sName & "; URL: " & sHref Next
Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!