Ask a Question

Check box stays in the unchecked state.

frysys
New Contributor

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 4
AlexanderM
Staff

RE: Check box stays in the unchecked state.

Hello Ian,




Probably, there are some scripts on the page that make the check box behave not the way it is supposed to.

To say something definite, I need to see the tested page. Save the page to an HTML file and send me the file:


-----

Alexander
Customer Care Manager
tppegu
Contributor

RE: Check box stays in the unchecked state.

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
New Contributor

RE: Check box stays in the unchecked state.

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
frysys
New Contributor

RE: Check box stays in the unchecked state.

Thanks

That worked
cancel
Showing results for 
Search instead for 
Did you mean: