Link Object

QTP Web Testing- Link Object
Methods & Properties that we can apply on Link Object
————————————————————
‘ChildObjects method on LinkĀ  Object
Dim oLink, Links
Set oLink = Description.Create
oLink(“micclass”).Value =”Link”
Set Links=Browser(“name:=Google”).Page(“url:=http://www.google.co.in”).ChildObjects(oLink)
Msgbox Links.count
————————————————————
‘Exist Property for Google News Link
If Browser(“name:=Google”).Page(“url:=http://www.google.co.in”).Link(“name:=News”).Exist(2) then

‘GetToProperty method on Link Object
x = Browser(“name:=Google”).Page(“url:=http://www.google.co.in”).Link(“name:=News”).GetTOProperty(“name”)
Msgbox x
————————————————————
‘GetROProperty method on Link Object
y = Browser(“name:=Google”).Page(“url:=http://www.google.co.in”).Link(“name:=News”).GetROProperty(“visible”)
Msgbox y

————————————————————
‘GetToProperties method on Google News Link
Set Gprops= Browser(“name:=Google”).Page(“url:=http://www.google.co.in”).Link(“name:=News”).GetTOProperties()
Gpropscount = Gprops.count
Msgbox Gpropscount
For i=0 to Gpropscount-1
Gpropsname = Gprops(i).Name
Gpropsvalue = Gprops(i).value
Msgbox Gpropsname & “=” & Gpropsvalue
Next
————————————————————
‘Click Method on Link Object
Browser(“name:=Google”).Page(“url:=http://www.google.co.in”).Link(“text:=News”).Click
If Browser(“name:=Google News”).Page(“title:=Google News”).Exist(2) Then
Msgbox “Google News page opened successfully”
End If
End If

Browser(“name:=Google News”).Close

 

 

Comments