This is my code I need to select the checkbox but couldn't select the checkbox.

<label class="">
    <span class="label-input">
    <div class="icheckbox" style="position: relative;">
    <input class="icheck" data-val="true" data-val-checkbox="Please confirm you have accepted Terms &amp; Conditions of Use." data-val-required="The Confirm you have accepted Terms &amp; Conditions of Use field is required." id="loginModel_IsAllCriteriaConfirm" name="loginModel.IsAllCriteriaConfirm" type="checkbox" value="true" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;">
        <input name="loginModel.IsAllCriteriaConfirm" type="hidden" value="false"></span>
        <span class="label-text">By ticking this box you also confirm that you <br>accept the Terms &amp; Conditions of Use.

I have tried

AutomationService.SelectCheckbox<HtmlCheckBox>(AutomationService.PropertyType.Id, "loginModel_IsAllCriteriaConfirm", "check");


AutomationService.Click<HtmlCheckBox>(AutomationService.PropertyType.Id, "loginModel_IsAllCriteriaConfirm");

but no success. Can someone help me with it?


1 Answer 1


Not sure what AutomationService.SelectCheckbox call is in your code but I have used the following code to select a CheckBox and has always worked for me:

((HtmlCheckBox)object).Checked = true;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.