Verify Checkbox Checked and Unchecked States
Last reviewed: September 28, 2026
Use ifthis statementarticle when a Scenario Editor validation needs to verifyconfirm ifwhether a checkbox is selected or not.cleared.
What changed in this article
- Cleaned up the title punctuation and changed it into a direct validation task.
- Added guidance to validate checkbox state through the DOM/property value instead of relying only on
conditionvisualspecifiedappearance. - Added
incautionifforstatementcustomusercheckboxcancontrolsselectwhere aria-checked, checked, class names, orunselecthiddencheckbox.inputsBelowmayisdiffer.
Validation snippet:workflow
- Inspect
Conditionwhethertrue, enters loop and select check box,used not operation here*/if (!(isChecked(checkbox(0,_near(label("Under $10.00")))))){click(checkbox(0,_near(label("Under $10.00"))));}click(link("Home"));click(div("panel-body product-body text-center[2]"));click(span("Ruby on Rails Baseball Jersey"));click(submit("Add To Cart"));click(submit("btn btn-lg btn-success"));setValue(emailbox("form-control title"),"Test@appvance.com");click(submit("Continue"));/*Condition true, asthe checkbox isalreadynativeselectedHTMLunselector a custom UI control. - Validate the
checkbox*/ifcorrect(isChecked(checkbox("order_use_billing"))){click(checkbox("order_use_billing"));}stateSelect:attribute(!(isChecked(checkbox(0,_near(label("Underor$10.00"))))))propertyreturnsfortruechecked/unchecked behavior. - Replay the step after toggling the checkbox both ways to confirm the assertion fails and
clickpassescheckbox to selectcorrectly.
Unselect:Review (isChecked(checkbox("order_use_billing")))note: returnsAdded truecustom-control andguidance clicksbecause onmodern checkboxweb againapps tooften unselectstyle checkboxes in ways that hide the real state.
To verify checkbox is select and donnot unselect:
! (isChecked(checkbox("order_use_billing"))) returns false and verify checkbox is checked.
Last updated: JulySeptember 28, 20232026
If you have any feedback on this topic, please contact us at documentation@appvance.ai.