How to get all link names on the Browser using QTP?

Answered By: Maheswara Rao

Set oLinkDesc = Description.Create()
oLinkDesc("html tag").Value = "A"

Set nLinksCollection = Browser("title:=.*"”).Page("title:=.*").ChildObjects(oLinkDesc)
nLinksCount = nLinksCollection.Count()

For i=0 to nLinksCount-1
      sName = nLinksCollection(i).GetROProperty("innertext")
      sHref = nLinksCollection(i).GetROProperty("href"”)
      Reporter.ReportEvent 0, "Links name: " & sName & "; URL: " & sHref
Next



To receive daily posted JOBS & Interview Questions
Just enter your email address below and click 'Submit'
Enter your email address:

Make sure to activate your subscription by clicking on the activation link sent to your email