'****************************************************************************************************************************
'Function Name : Fun_CheckObjectAndReport
'Description Use this function to check the existence of object and report pass/fail
'Parameters strStepName , strDescription
'Return Val ue True/False
'Registerd To Web Objects
' Ex:ample Fun_CheckObjectAndReport "Main Menu" , "Header displayed"
'****************************************************************************************************************************
Public Function Fun_CheckObjectAndReport(ByRef test_object , strStepName )
Dim strParentMicClass
Dim objParent
'Set the mic class of the parent object
strParentMicClass = "Browser"
'Check if object exists and do the reporting success
If test_object.Exist Then
Fun_ReportSuccess strStepName , "Exists"
Fun_CheckObjectAndReport = True
Else
'If object doesn't exist get the parent object and have a snapshot of the screen report failure
Set objParent = test_object.GetTOProperty("parent")
Do Until objParent.GetROProperty("micclass") = strParentMicClass
Set objParent = objParent.GetTOProperty("parent")
Loop
Fun_ReportFailure strStepName , "Doesn't Exists" , objParent
Fun_CheckObjectAndReport = False
End If
'Kill the objects
Set objParent = Nothing
End Function
RegisterUserFunc "WebElement", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "Link", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "Image", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "WebButton", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "Browser", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "Window", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
'Function Name : Fun_CheckObjectAndReport
'Description Use this function to check the existence of object and report pass/fail
'Parameters strStepName , strDescription
'Return Val ue True/False
'Registerd To Web Objects
' Ex:ample Fun_CheckObjectAndReport "Main Menu" , "Header displayed"
'****************************************************************************************************************************
Public Function Fun_CheckObjectAndReport(ByRef test_object , strStepName )
Dim strParentMicClass
Dim objParent
'Set the mic class of the parent object
strParentMicClass = "Browser"
'Check if object exists and do the reporting success
If test_object.Exist Then
Fun_ReportSuccess strStepName , "Exists"
Fun_CheckObjectAndReport = True
Else
'If object doesn't exist get the parent object and have a snapshot of the screen report failure
Set objParent = test_object.GetTOProperty("parent")
Do Until objParent.GetROProperty("micclass") = strParentMicClass
Set objParent = objParent.GetTOProperty("parent")
Loop
Fun_ReportFailure strStepName , "Doesn't Exists" , objParent
Fun_CheckObjectAndReport = False
End If
'Kill the objects
Set objParent = Nothing
End Function
RegisterUserFunc "WebElement", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "Link", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "Image", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "WebButton", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "Browser", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
RegisterUserFunc "Window", "Fun_CheckObjectAndReport", "Fun_CheckObjectAndReport"
No comments:
Post a Comment