> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-web/en/when-the-test-doesnt-work/test-issues/checkbox-assersion-troubleshooting.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# Checkbox and radio button assertions

## Checkbox and radio button assertions

Autify's [**Checkbox Assertions**](https://help.autify.com/nocode-web/en/autify-university/advanced/assertions-1/assertion-elements-on-the-page.md) allow you to assert whether an element is checked/unchecked (selected/unselected). You can also assert whether a check box or radio button is valid or invalid (selectable or not selectable).

However, depending on the implementation of the target web application, you may get unexpected test results. In this article, you will learn how to troubleshoot issues related to checkboxes.

### During test runs, assertions to check if a checkbox is selected/unselected fail

When the target element is not an input element, whether a checkbox is selected/unselected is determined by Autify's ML (Machine Learning). If the accuracy is not sufficient, it will incorrectly determine the selected/unselected status of the element and display the following error message.

Error message examples:

```
The checkbox should be unselected, but it is selected.
The checkbox should be selected, but it is not.
```

In this case, you may be able to solve the problem using one of the following functions:

* [Quick Element Update](https://help.autify.com/nocode-web/en/autify-university/foundation/test-results/quick-element-update.md)
* [Locator](https://help.autify.com/nocode-web/en/autify-university/advanced/locator-feature/add-a-locator.md)
* [Visual regression testing for elements](https://help.autify.com/nocode-web/en/autify-university/advanced/visual-testing/visual-regression-testing-for-elements.md)

If you're using the Quick Element Update feature or a locator, the key is to select an input element. This allows Autify to see the selection status of the input element (checked attribute), which may allow it to correctly determine the selection status.

If the checkbox is not implemented using an input element (for example, the checkbox is created by applying a checkbox-like style to a div or span tag), you will need to use a JS Step to validate the style. Visual regression testing on the element can also correctly determine the selection status.

### Checkbox assertion step cannot be added during recording

If you have implemented a custom checkbox and have hidden the checkbox's input element using `display: none`, for example, Autify Recorder will not be able to detect the element and will not display the valid/invalid assertion command ("Element Should Be Enabled" and "Element Should Be Disabled"), preventing you from selecting it.

You can add an assertion to check whether an element is invalid (or valid) by displaying the input element. To do this, open DevTools during recording and temporarily delete the style `display: none` for the input element. However, the input element will not be displayed in the test result, so the target element will not be focused in the test result screenshot.

## If the issue is still not resolved...

Please contact our customer support team. We will help you resolve the issue.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-web/en/when-the-test-doesnt-work/test-issues/checkbox-assersion-troubleshooting.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
