Forum Discussion

harshad_w's avatar
harshad_w
Occasional Contributor
5 years ago

How to change the check box's state if it's not mappable individually?

Hi,

 

I want to tick the checkbox with a label. The checkbox is not mapped as an individual object. I tried various methods like 

 

set_IsChecked, set_IsSelected, etc. I am passing a boolean value (true) in order to mark it checked. It's not working. 

 

I have attached a video that will describe the problem.

 

Thanks

  • If checkboxes are not  seen in spy then did u added the TreeView class  on the proper TestComplete Object Mapping entry (Tools \ Current Projet Properties) and then access to correct methods/properties ?

     

    Normally after that  your check box has the Checked property. And then just check its value and use object

     

    Did the label is seen as indiviual object ? If yes u can (dbl)click on it to set/unset the checkbox.

     

    If nothing work u can always click on it and then do pixel check (i know this is the very end way ..)

     

  • BenoitB's avatar
    BenoitB
    Community Hero

    If checkboxes are not  seen in spy then did u added the TreeView class  on the proper TestComplete Object Mapping entry (Tools \ Current Projet Properties) and then access to correct methods/properties ?

     

    Normally after that  your check box has the Checked property. And then just check its value and use object

     

    Did the label is seen as indiviual object ? If yes u can (dbl)click on it to set/unset the checkbox.

     

    If nothing work u can always click on it and then do pixel check (i know this is the very end way ..)

     

    • harshad_w's avatar
      harshad_w
      Occasional Contributor

      Thanks for the quick suggestions. I can find the "Header" and it has the "set_IsChecked(boolean)" method which does the job of selecting the checkbox. 

       

      Thanks,

      H

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hi,

    1) First try to record the script from TestComplete and then check what is automatically generated by TestComplete for you. This is the easiest solution to have "some general idea" how to solve a new thing.


    2) In the video you present the "set_IsSelected" method. I'm not sure if this is the right way to do such things. You want to check this check box and check its state, so try to look at its state in the "Properties" tab.

     

    3) Also, consider to add "class name" of Your custom object into options:

    https://support.smartbear.com/testcomplete/docs/working-with/managing-projects/properties/object-mapping.html

     

    Hope this may help You!