Forum Discussion

jdodds's avatar
jdodds
New Contributor
12 years ago

checking for a check in checkbox

I am a new TestComplete user and trying to create a keyword test to see if a checkbox is checked on a web application.  If it is not checked, then I'd like the test to check the box.  If the box is already checked then I'd like the test to move to the next checkbox and do the same type of check.



Could you please help me setup this test?  I tried to use the If . Then statments but was not sure of the Value field.



Thanks!

2 Replies

  • 1. Use the 'Find Object' test action to see if the checkbox is checked using the 'checked [get]' operation. It will return a True if it is checked and a False if it isn't.

    2. Use the 'If... Then' test action to check if the 'LastResult equals false'

    3. Indent this line, then, use the 'Find Object' test action with the 'ClickChecked' operation, to check the checkbox.



    Ultimately:



    Find out if checkbox is checked, if it isn't checked then check it. ;)



    Repeat the steps for each checkbox...and don't forget to add comments if there are lots of checkboxes since it can be tricky to edit if there are a lot of them!
  • I think you should try to check if Checked property of the checkbox is True.