Sunday 18 January 2015

UFT - QTP - How to check presence of a Edit box or webedit on web page


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


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


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

No comments:

Post a Comment