Wednesday, 16 September 2015

HOW TO GET LINK NAMES AND URLS FOR ALL THE LINKS ON A WEB PAGE IN QTP



Steps:
Create object using description object
Assign link to object using value method
Using child objects assign to variable
Assigning the data to variable by using child objects
Count the links by using the count function
Use for loop for repeting no of links
Use getroproperty  for capturing the name & url

Ans:
Set Des_Obj = Description.Create
Des_Obj("micclass").Value = "Link"
Set link_col = Browser("name:=Google").Page("title:=Google").ChildObjects(Des_Obj)
a= link_col.count

For i=0 to a-1
tag = link_col(i).GetROProperty("name")
href = link_col(i).GetROProperty("url")
msgbox tag &" " & href
Next


SUBSCRIBE YOUTUBE CHANNEL FOR LATEST VIDEOS 
https://www.youtube.com/channel/UC1EmncBu2maDiHNMNNqxw9g

No comments:

Post a Comment