Forum Discussion

rushikesh's avatar
rushikesh
Contributor
6 years ago
Solved

When a checkbox is checked/unchecked in Test Complete it logs error

I am using below code to check/uncheck a checkbox. The checkbox in application is sucessfully checked/unchecked, but i am getting following error in log "The tree node's '[0]' state image was clicked...
  • TanyaYatskovska's avatar
    6 years ago

    Hi rushikesh,

     

    I assume the check action is associated with an event handler in your app and the event in question does not fire in your case. In such situations, it's usually a good idea to try to simulate a mouse click or a spacebar keystroke over the object to make sure the action simulated by TestComplete is as close to real-life user interaction as possible.

     

    In your script, you use Check(cbChecked) action. According to this article, this action moves the mouse pointer to the item and set its value. However, TestComplete doesn't click it.

     

    Since you need to trigger the event handler, I recommend that you use just a single action (without wState assignment) to interact with the checkbox. The action can be any of the following:

    ...ClickChecked(false)  
    ...Click() // this assumes the checkbox is not in the needed state
    ...Keys(" ") // this assumes the checkbox is not in the needed state

    Does it help?