Skip to main content

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.

Based

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 conditionvisual specifiedappearance.
  • Added incaution iffor statementcustom usercheckbox cancontrols selectwhere aria-checked, checked, class names, or unselecthidden checkbox.inputs

    Belowmay isdiffer.

code

Validation snippet:workflow

navigateTo("https://demosite.appvance.com/");
click(link("/t/bags"));
/*If

  1. Inspect Conditionwhether true, 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 is alreadynative selectedHTML unselector a custom UI control.
  2. Validate the checkbox*/
    ifcorrect (isChecked(checkbox("order_use_billing"))){
    click(checkbox("order_use_billing"));
    }state

    Select:attribute (!(isChecked(checkbox(0,_near(label("Underor $10.00"))))))property returnsfor truechecked/unchecked behavior.

  3. Replay the step after toggling the checkbox both ways to confirm the assertion fails and clickpasses checkbox 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.