Sunday 21 December 2014

UFT - QTP How to check presence of an Image on 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 Image we want to verify
propertyvalue is the Property value of the Image we want to verify
Index - Index starts from 0


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






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

No comments:

Post a Comment