--- title: "Mastering Element Assertions in Autify | Autify Guide" slug: "assertion-elements-on-the-page" description: "Efficient Validation Techniques: Learn to Apply Assertions on Elements in Autify. Start your Free Trial!" updated: 2026-06-23T06:16:10Z published: 2026-06-23T06:16:10Z canonical: "help.autify.com/assertion-elements-on-the-page" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # Assertions on elements in a page ## 1. General assertions The assertions in this section work on **any kind of HTML elements**. ### Visibility assertion | Keyword | Description | | --- | --- | | Element Should Be Visible | Verify that the target element is visible | Tip This assertion will fail if the target element exists in the HTML code but is not visible due to `display: none;`, `visibility: hidden;` or `opacity: 0;`, or the target element is outside of viewport. See also the following FAQ: [What is the difference between "Page Should Contain Element" and "Element Should Be Visible"?](/v1/docs/what-is-the-difference-between-page-should-contain-element-and-element-should-be-visible) ### Basic text assertions | Keyword | Description | | --- | --- | | Element Text Should Be | Verify that the string of the target element exactly matches the specified string | | Element Should Contain | Verify that the target element contains the specified string | | Element Should Not Contain | Verify that the element does not contain the specified string of characters | | Element text should start with | Verify that the string of the target element starts with the specified string | | Element text should not start with | Verify that the string of the target element does not start with the specified string | | Element text should not be empty | Verify that the target element contains one or more non-space characters (Space characters include spaces, tabs, line breaks such as LF, CR, etc.) | Tip This assertion will fail if the target element exists in the HTML code but is not visible due to `display: none;`, `visibility: hidden;` or `opacity: 0;`. ### Text assertions with RegExp | Keyword | Description | | --- | --- | | Element text should match **RegExp** | Verify that the string of the target element matches the given **RegExp** | | Element text should not match **RegExp** | Verify that the string of the target element does not match the given **RegExp** | Using **RegExp**, you can create pretty flexible text assertions that fit your use case. Here are some RegExp ideas for your reference: - **`^Good (morning|night)`** - Text that starts with `Good morning` or `Good night` - Matching examples: `Good night`, `Good morning, Hatty!` - **`w[ow]+w$`** - Text that matches `w` followed by one or more `o` or `w` and ends with `w` - Matching examples: `wowow`, `Oh, wow` - **`^\d{3}-\d{4}$`** - Text that starts with 3 consecutive digits followed by a hyphen and ends with 4 consecutive digits - Matching examples: `123-4567`, `999-0000` For more information about its syntax, see [Regular expression syntax cheat sheet (MDN)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet) Note - Text assertions with RegExp will fail when the given RegExp contains any syntax error. - Flags such as `i` (ignore casing) or `m` (multiline) are not supported. ### Checkbox assertions | Keyword | Description | | --- | --- | | Checkbox Should Be Selected | Verify that the checkbox or radio button is checked. | | Checkbox Should Not Be Selected | Verify that the checkbox or radio button is not checked. | Tip Autify's ML-powered assertions on checkboxes work not only on `<input type="checkbox">` elements but also any elements that look like checkboxes, such as `<div>` and `<span>` elements disguised as checkboxes using styles! ### Number assertions The following assertions are based on the numbers and ". (period)" . Specifically, assertions are made on the first digit (0 - 9) through all non-numeric characters (including commas) in the text. Thus, for example "$1,234", if the text contains ", (comma)", the assertion is made for 1 only. | Keyword | Description | | --- | --- | | Number should be greater than | Verify that the number is greater than the given value | | Number should be smaller than | Verify that the number is smaller than the given value | Note Number assertions will fail when the target is not a number. ### Class assertions | Keyword | Description | | --- | --- | | Element classname should contain | Verify that the element contains the given class name | | Element classname should not contain | Verify that the element does not contain the given class name | Class names are detected by partial matching. For example, if you specify `state-1` for the class name, it matches with the following: - `<div class="state-10">` - `<div class="sample-a state-1">` One of the use cases of this assertion can be to verify the presence or absence of a class to which a particular style is applied. ## 2. Interactivity assertions The following assertions work on `BUTTON`, `INPUT`, `SELECT`,` TEXTAREA`, `OPTGROUP`, `OPTION`, and `FIELDSET`. | Keyword | Description | | --- | --- | | Element Should Be Enabled | Verify that the element is interactable (Checks if the element **has not disabled or readonly** attribute) | | Element Should Be Disabled | Verify that the element is not interactable (Checks if the element **has disabled or readonly** attribute) | Note Even if the element looks like a `<button>` or a `<select>` element, these commands will not be shown if it is actually implemented as a different element decorated by CSS. And also, Elements that don’t have a disabled attribute but cannot be operated with JavaScript are considered to be enabled. ## 3. Form element assertions ### Input assertions The following assertions work on `INPUT` elements. | Keyword | Description | | --- | --- | | Textfield Value Should Be | Verify that the content entered in the text field exactly matches the specified string | | Textfield Should Contain | Verify that the content entered in the text field contains the specified string | ### Textarea assertions The following assertions work on `TEXTAREA` elements. | Keyword | Description | | --- | --- | | Textarea Value Should Be | Verify that the content entered in the text area exactly matches the specified string | | Textarea Should Contain | Verify that the content entered in the text area contains the specified string | ### Pull-down menu assertions The following assertions work on `SELECT` elements. `SELECT` elements let users choose an option from multiple options, and they are often referred to as a drop-down list, pull-down menu, list box, etc. ![](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/zndsk-listbox.png?sv=2026-02-06&spr=https&st=2026-11-11T15%3A26%3A53Z&se=2026-11-11T16%3A26%3A53Z&sr=c&sp=r&sig=Gf3Y493p1utMoFkNLAabmkM5xPBGSUU3xvDUlHFWlbQ%3D) | Keyword | Description | | --- | --- | | List Selection Should Be | Verify that the option that match the specified string is selected | | List Should Have No Selections | Verify that nothing is selected with select with "multiple" attribute. | Note that this may not work well when multiple options are selected, and it will be supported in the future. ### Tips for pull-down menu assertions If the default option is selected for an element in a selection, it cannot be verified by **List Should Have No Selections**. For example, the following screenshot shows a pulldown included in the form to request a demo of Autify, where the **Company Size** is displayed at the top, is not a **No Selections** state, but the option **Company Size** is selected. ![](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/zndsk-Screen_Shot_2021-05-01_at_9.55.06.png?sv=2026-02-06&spr=https&st=2026-11-11T15%3A26%3A53Z&se=2026-11-11T16%3A26%3A53Z&sr=c&sp=r&sig=Gf3Y493p1utMoFkNLAabmkM5xPBGSUU3xvDUlHFWlbQ%3D) If you want to check if the default choices are selected, use the **"List Selection Should Be"** option instead of the **"List Should Have No Selections"** option.