Sunday, 21 December 2014

UFT - QTP - How to check presence of Link on a web page

                                        Link to Mandatory QTP /UFT Interview Questions to read before Interview


Function Parameters
objPageName is the Page object link "Browser("*******").Page("*******")
PropertyName is the Property name of the link we want to verify
propertyvalue is the Property value of the link we want to verify
Index - Index starts from 0


Function VerifyLink(byval objPageName,  byval PropertyName, byval propertyvalue, byval Index)
   Set ObjPage= objPageName
   If Index = "" Then
    If ObjPage.Link(PropertyName&":="&propertyvalue).exist(10) then
    ObjPage.Link(PropertyName&":="&propertyvalue).highlight ' comment later
    Reporter.ReportEvent 4"VerifyLink""Checking for link"& propertyvalue
    Reporter.ReportEvent micPass,"VerifyLink","Link with Property " & PropertyName & "Property Value " & propertyvalue & "Found"
    VerifyLink =0
   Else
    Reporter.ReportEvent 4"VerifyLink""Checking for link"& propertyvalue
    Reporter.ReportEvent micFail,"VerifyLink","Link with Property " & PropertyName & "Property Value " & propertyvalue & "was not Found or available"
    VerifyLink = 1
  End if
 else
  If ObjPage.Link(PropertyName &":="& propertyvalue, "Index:="& Index).exist(10) then
    ObjPage.Link(PropertyName&":="&propertyvalue, "Index:="& Index).highlight ' comment later
    Reporter.ReportEvent 4"VerifyLink""Checking for link"& propertyvalue
    Reporter.ReportEvent micPass,"VerifyLink","Link with Property" & PropertyName & "Property Value" & propertyvalue & "Found"
    VerifyLink =0
   Else
    Reporter.ReportEvent 4"VerifyLink""Checking for link"& propertyvalue
    Reporter.ReportEvent micFail,"VerifyLink","Link with Property" & PropertyName & "Property Value" & propertyvalue & "was not Found or available"
    VerifyLink = 1
  End if
End If
End Function


Regards,
Sreenu Babu

                                        Link to Mandatory QTP /UFT Interview Questions to read before Interview

No comments:

Post a Comment