Forum Discussion

frysys's avatar
frysys
New Contributor
15 years ago

Check box stays in the unchecked state.

Running ASP.net and setting a checkbox to checked = True,

It all works but an error goes to the log indicating



"Check box stays in the unchecked state."

This is strictly a 2 state control

4 Replies

  • I've encountered the same problem. My assumption was also that there were scripts on the page that interfere, although it never seems to happen during manual testing. In fact there are a few places where I have seen distinct differences in behaviour between a real mouse click and a TC simulated mouse click, and it's always in areas where there are event handlers in the page scripts. My guess is that whatever TC is doing to simulate clicks is not firing the right event handlers, or perhaps firing them in the wrong order.



    Anyway, the workaround I use for the problematic checkboxes is as follows (JScript):


    function ClickCheckbox(cb, state)

    {

    if(cb.Exists)

    {

    while(!cb.WaitProperty("checked", state, 500))


    {

    cb.Click();

    cb.Refresh();

    }

    }

    }




    There should really be a timeout or loop counter in there, as there is the possibility of an infinite loop, but in my case the problem always seems to be temporary, so this works fine for me.


  • frysys's avatar
    frysys
    New Contributor
    Thanks Tony,

    This is a standard asp.net checkbox.

    There is code behind the click event (which is what I am trying to test).

    I will try your routine and let you know. Next Year :)

    Thanks to everyone for responding