Wednesday 24 July 2013

Get links and text from any web browser using QTP

systemutil.Run "firefox","http://argos.co.uk"

browser("title:=.*").page("title:=.*").Sync
Set li=description.Create()
li("micclass").value="link"
Set a=browser("title:=.*").page("title:=.*").ChildObjects(li)
'msgbox a.count
num=a.count
For i=0 to num-1
   'tag = a(i).GetROProperty("innertext")
   'href = a(i).GetROProperty("href")
   'Reporter.ReportEvent 0,  "Links in Page", "name:" & tag &  ";url: " & href
    print a(i).GetROProperty("text")
    print a(i).GetROProperty("href")
Next

No comments:

Post a Comment