Thursday, 8 January 2015

UFT - QTP How to Click on Link on Web page

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

Function ClickOnLink(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
    ObjPage.Link(PropertyName&":="&propertyvalue).click
    Reporter.ReportEvent 4"ClickOnLink""Checking for Link"& propertyvalue
    Reporter.ReportEvent micPass,"ClickOnLink","Link with Property " & PropertyName & "Property Value " & propertyvalue & "Found"
    Reporter.ReportEvent micPass,"ClickOnLink","Link with Property " & PropertyName & "Property Value " & propertyvalue & "Clicked"
    ClickOnLink =0
   Else
    Reporter.ReportEvent 4"ClickOnLink""Checking for Link"& propertyvalue
    Reporter.ReportEvent micFail,"ClickOnLink","Link with Property " & PropertyName & "Property Value " & propertyvalue & "was not Found or available"
    ClickOnLink = 1
  End if
 else
  If ObjPage.Link(PropertyName&":="&propertyvalue, "Index:="&Index).exist(10) then
    ObjPage.Link(PropertyName&":="&propertyvalue, "Index:="&Index).click
    Reporter.ReportEvent 4"ClickOnLink""Checking for lmage "& propertyvalue
    Reporter.ReportEvent micPass,"ClickOnLink","Link with Property " & PropertyName & "Property Value" & propertyvalue & "Found"
    Reporter.ReportEvent micPass,"ClickOnLink","Link with Property " & PropertyName & "Property Value " & propertyvalue & "Clicked"
    ClickOnLink =0
   Else
    Reporter.ReportEvent 4"ClickOnLink""Checking for Link"& propertyvalue
    Reporter.ReportEvent micFail,"ClickOnLink","Link with Property  " & PropertyName & "Property Value" & propertyvalue & "was not Found or available"
    ClickOnLink = 1
  End if
 End If
End function

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

No comments:

Post a Comment