Wednesday, 16 January 2013

Creating Checkbox using VB Scripts

Function SelectCheckBox(rootObj,chkNum) 
 On Error Resume Next
 Dim chkNumb
 chkNumb=Cint(chkNum)
 Set cDescCheckBox1= Description.Create
 cDescCheckBox1("type").value = "checkbox"
 cDescCheckBox1("html tag").value = "INPUT"
  'Set rootObject=Browser("Optus Online Store").Page("Optus Online Store").Frame("mainFrame")
   Set objCheck =  rootObj.ChildObjects(cDescCheckBox1)
  If objCheck.count >0 Then
                EnabledStatus=objCheck(chkNumb).getroproperty("disabled")
  Else
                Reporter.ReportEvent micFail,"Unable to retrieve check box items in the page","Extra features are not populated"
   End If


   If EnabledStatus=0 Then
        objCheck(chkNumb).set "ON"
        On Error GoTo 0
         If Err.Number<> 0 Then
               Reprter.reporter 1,"Unable to select checkbox","Either incorrect check box or check box is disabled"
               Err.Clear
         End If
       Wait(3)
   End If


End Function

No comments:

Post a Comment