Forum Discussion

googleid_105206's avatar
googleid_105206
Contributor
12 years ago

Unable to select and Deselect Checkbox ?

Hi

I am Working on Flex4.5 based application using TestComplete 9.10

I am trying  click/select Checkbox. .By using SelectItem method i can able select checkbox label ,but not  able select /unselect (on/off)checkbox .Please suggest me how handle this type of  Checkboxs.please find the attached Screenshots.

i followed below method to handle checkbox:

Sub handleCheckbox()

Set objPanel=Sys.Browser("firefox").Page("*").Panel("bodyContent").Scroller(0).VGroup(0).VGroup("allPropertyTabsGroup").List("allPropertyTabsList")

  ItemText="Occurrence Information"

   Set dataProvider = objPanel.FlexObject.dataProvider

  found = False



   For i = 0 To dataProvider.length-1

    If dataProvider.source.item(i).tabName=ItemText Then

    log.Message (dataProvider.source.item(i).tabName)

    ItemIndexByText = i

    log.Message ItemIndexByText



    delay 5000

  objPanel.SelectItem(ItemIndexByText),True

 found = True

    Exit For

   End If

  Next

End Sub









Thanks ,

Vijay











4 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Vijay,


     


    Have you tried passing False as the second parameter to the SelectItem method to deselect the item?


     

  • Hi Tanya,

    i tried passing False statement to deselect the item.

    objPanel.SelectItem(ItemIndexByText),False Method.But not unselect checkbox.

    This method only giving select status of the checkbox label/Item.please find the attached screen shots.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Vijay,


     


    According to your screenshots, everything is OK - after executing the method, the value of the selected property is False, and the item is visually unchecked. That's why, I don't quite understand what is going wrong. Could you please describe the expected and the actual behavior? Besides, can you post here a sample app with this control that we can test?


     

  • vadaliprasad's avatar
    vadaliprasad
    Occasional Contributor
    Hi Tanya,

    We found a solution for this.

    Here is how we achieved this:

    Set containerObj=Nothing
    propNames = Array("ObjectLabel","ObjectType")
    propValues = Array("allPropertyTabsList","CustomSparkListComponent")
    set containerObj = frameObj.FindChild(propNames,propValues,3)

    For i = 0 to containerObj.FlexObject.dataProvider.length-1
    ItemText(i)=containerObj.FlexObject.dataProvider.source.item(i).tabName
    Set Project.Variables.opObj = Nothing
    propNames = Array("ObjectType", "FlexObject.data.tabName")
    propValues = Array("ListItem", ItemText(i))
    Set Project.Variables.opObj = containerObj.FindChild(propNames, propValues, 2)
    Project.Variables.opObj.FlexObject.setVisible(1)
    If Project.Variables.opObj.exists Then
    If containerObj.FlexObject.dataProvider.source.item(i).selected="True" Then
    Log.Message "Required Property Panel '"&ItemText(i)&"' already selected"
    call logs(sHTML,functionName,"Required Property Panel '"&ItemText(i)&"' already selected","Pass")
    Else
    Call Project.Variables.opObj.Click(10,10)
    End If
    End if
    Next


    Please suggest if there is better way of achieving this functionality