Ask a Question

The check box was clicked, but the specified state was not set up?


The check box was clicked, but the specified state was not set up?

Hello, I'm relatively new to the testcomplete software.  I've been running using it for about a month or so.  I learned most of what I know by experimenting or reading on forums. 


I've run into something that seems to be relatively simple but I cannot figure it out.  I am running keyword tests.  One of the testscases involves attempting to remove a default language in which an alert box appears to tell me that a default language is required.  However,  this alert box results in test complete not being able to  get the specified state of the check box.  This causes an error and I can't seem to figure my way around it.

Champion Level 2

Do you click ok to get the alert box to go away before going back to the check boxes?


If not, you need to do that first to get TestComplete to focus properly.


If you are, then try either putting a delay between clicking on the alert box and looking for the check box, or using Set Focus on the check box before looking for the state (or try both!).



It is my guess that the following occurs:

-- TestComplete clicks the checkbox for the default language to clear (unselect) it;

-- Some JScript code attached to the OnStateChange/OnClick/etc. event for the checkbox on the web page detects that the check box cannot be cleared, selects it again and displays the warning message;

-- TestComplete detects that the checkbox was clicked successfully but its state did not change and posts an error to the log.


If the above sounds reasonable for the given case, I would try not to click the checkbox, but to set a focus to it and emulate pressing the Space key (which should uncheck the checkbox). Something like oChkBox.Keys(" "). .Keys() method just sends corresponding key code(s) to the message queue and does not perform any additional verifications, so this should not post any error to the test log and you should be able to check if the warning message was shown or not.

  /Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.

Yes, it is closer to the scenario you have provided.  The language box is already defaulted.  When I proceed to uncheck the box, an alert message appears which tells me that a default language has to be selected.  In which the checkbox will then be left checked.  However, testcomplete gets confused because it does not seem to notice that the box was left in the checked state.  This throws back an error.  I am working strictly with keyword testing but willing to give anything a try. Thanks.




First, I was wondering if we can delete posts.  I am new to this forum and double posted.


Next.  The space key does in fact uncheck the box but it functions just like a left-click.  The alert still comes up in which makes it so testcomplete  is unable to find the value.  Is there a way to check/uncheck boxes while ignoring the values?

Yes, when I am recording the keyword tests, I am able to get the alert box to go away by pressing ok.  However, the software testcomplete, is unable to see that the checkbox remained untouched because the alert box popped up.



Neither of the suggested solutions worked for me.  I was wondering if I could use the WaitProperty method to fix this.  I'm not too familiar with WaitProperty but my idea is just to somehow delay the ClickChecked operation until I press "OK" from the alertbox.

Showing results for 
Search instead for 
Did you mean: