QTP LR JSP ORACLE
checkbox
上一篇 /
下一篇 2008-05-26 18:57:24
/ 个人分类:QuickTestProfessional
'================================================================
' FUNCTION NAME:
' FindCheckBox
' FUNCTION DEscrīptION:
' Find the corresponding webcheckbox of title object in parent object, and output the webcheck
' FUNCTION USAGE:
' Set parentObject = Browser("ATS Login").Page("ATS Login").Frame("mainRight")
' Set titleObject = Browser("ATS Login").Page("ATS Login").Frame("mainRight").Link("test")
' ret = FindCheckBox(parentObject, titleObject, checkBoxObject)
' checkBoxObject.Set "ON"
' FUNCTION PARAMETER
' ParentObject: The parent object of title object and webcheckbox object
' TitleObject: The title object
' CheckBoxObject: [Output Param] Output the corresponding webcheckbox object of title object
' FUNCTION RETURN:
' 0: Success to find and output the corresponding webcheckbox object of title object
' -1: Fail to find the corresponding webcheckbox object of title object
' FUNCTION ORIGINAL CREATOR:
' yabest
' FUNCTION CREATION DATE:
' 2007-08-30
' FUNCTION UPDATE HISTORY:
'===============================================================
Function FindCheckBox(ByVal ParentObject, ByVal TitleObject, ByRef CheckBoxObject)
Dim titleObjectY1, titleObjectY2, curChildObjectMidY
Dim checkBoxDesc, childObjects
Dim childNum, childIndex, findIndex
'Get the title object's top/bottom y position
titleObjectY1 = CInt(TitleObject.GetROProperty("abs_y"))
titleObjectY2 = CInt(TitleObject.GetROProperty("abs_y")) + CInt(TitleObject.GetROProperty("height"))
'get all webcheckbox objects
Set checkBoxDesc = Descrīption.Create()
checkBoxDesc("micclass").Value = "WebCheckBox"
Set childObjects = ParentObject.ChildObjects(checkBoxDesc)
'search the webcheckbox according y position.
childNum = childObjects.Count
findIndex = -1
For childIndex = 0 to childNum-1
Set curChildObject = childObjects(childIndex)
curChildObjectMidY = CInt(curChildObject.GetROProperty("abs_y")) + CInt(curChildObject.GetROProperty("height"))/2
'the webcheckbox should be: (y+height/2) in [titleObjectY1, titleObjectY2] area
If curChildObjectMidY>=titleObjectY1 and curChildObjectMidY<= titleObjectY2 Then
findIndex = childIndex
Exit For
End If
Next
'if not found, return fail
If findIndex = -1 Then
FindCheckBox = -1
Exit Function
End If
'if found, return success
Set CheckBoxObject = curChildObject
FindCheckBox = 0
End Function
收藏
举报
TAG: