Forum Discussion

salley's avatar
salley
Frequent Contributor
7 years ago
Solved

how to findallchildren and click during the runtime

Hi experts, i've a web screen with questionnaire and i need to click on no to all during the run time, can that be handled through script, can somebody provide me a sample script.  type is radio bu...
  • cunderw's avatar
    cunderw
    7 years ago

    I'm not super familiar with VBScript but it looks like this is because of how your setting sRadioButtons.

     

    The result of FindAllChildren is an array so you need to work with it as such. Try this:

     

    function findallchild
      Dim PropName, PropValues,i,sRadioButtons
      PropNames=Array("ObjectType","ObjectLabel")
      PropValues=Array("RadioButton","No")
      Set sPage=Sys.Browser("iexplore").Page("http://me-aptweb1/Affiliation/Questionnaire.aspx")
      sRadioButtons=sPage.FindAllChildren(PropNames,PropValues,100)
      If UBound (sRadioButtons)>=0 Then
        For i = 0 To UBound(sRadioButtons)
            sRadioButtons(i).Click
        Next
        Log.Message "Total objects found: " & (UBound(sRadioButtons) + 1)
      End If
    End Function