Skip to main content

Assertions

Assertions in Tacl allow you to validate the expected behavior and state of web elements as part of your automation workflow. Assertions are categorized based on the type of validation they perform, such as checking element state, text, attributes, and more.

Assertions

State Assertions

To Be Checked

Validates if a checkbox or radio button element is checked.

To verify if an element is checked:

  • Select the To Be Checked assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Be Checked

To Be Checked Configuration:

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element’s checked state to be validated.

  • Not (Optional)
    Reverses the assertion to check that the element is not in the checked state.


To Be Disabled

Checks if an element is disabled and cannot be interacted with. Element is disabled if it has disabled attribute or is disabled via aria-disabled. Note that only native control elements such as HTML <button>, <input>, <select>, <textarea>, <option>, optgroup can be disabled by setting "disabled" attribute. "disabled" attribute on other elements is ignored by the browser.

To verify if an element is disabled:

  • Select the To Be Disabled assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Be Disabled

To Be Disabled Configuration:

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element to be confirmed as disabled.

  • Not (Optional)
    Reverses the assertion to check that the element is not disabled.


To Be Editable

Asserts if an <input> or <text area> element is editable.

To verify if an element is editable:

  • Select the To Be Editable assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Be Editable

To Be Editable Configuration:

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element to be validated as editable.

  • Not (Optional)
    Reverses the assertion to check that the element is not editable.


To Be Empty

Validates that an element (such as an <input> field) has no value or text content.

To verify if an element is empty:

  • Select the To Be Empty assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Be Empty

To Be Empty Configuration:

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element to be validated as empty.

  • Not (Optional)
    Reverses the assertion to check that the element is not empty.


To Be Enabled

Checks if an element is enabled and can be interacted with.

To verify if an element is enabled:

  • Select the To Be Enabled assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Be Enabled

To Be Enabled Configuration:

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element to be confirmed as enabled.

  • Not (Optional)
    Reverses the assertion to check that the element is not enabled.


To Be Focused

Asserts that an element currently has focus, ensuring it is ready for interaction.

To verify if an element is focused:

  • Select the To Be Focused assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Be Focused

To Be Focused Configuration:

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element to gain focus.

  • Not (Optional)
    Reverses the assertion to check that the element is not focused.


To Be Hidden

Validates if an element is not visible on the page.

To verify if an element is hidden:

  • Select the To Be Hidden assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Be Hidden

To Be Hidden Configuration:

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element to be confirmed as hidden.

  • Not (Optional)
    Reverses the assertion to check that the element is visible.


To Be Visible

Checks if an element is visible on the page and not hidden by CSS properties like display: none or visibility: hidden.

To verify if an element is visible:

  • Select the To Be Visible assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Be Visible

To Be Visible Configuration:

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element to be confirmed as visible.

  • Not (Optional)
    Reverses the assertion to check that the element is hidden.

note

To check that at least one element from the list is visible, use filter position with value 0 in identifiers.


Text Assertions

To Contain Text

Asserts that an element contains a specified substring within its text content. All nested elements will be considered when computing the text content of the element. You can use regular expressions for the value as well.

To verify if an element contains specific text:

  • Select the To Contain Text assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Contain Text

To Contain Text Configuration:

  • Expected Text (Mandatory)
    The substring that should be contained within the web element’s text.

  • Ignore Case (Optional)
    Determines whether the text comparison should ignore case differences.

  • Use Inner Text (Optional)
    When enabled, matches the inner text rather than the entire element text content.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the text content validation.

  • Not (Optional)
    Reverses the assertion to check that the element does not contain the specified text.

note

When expected text is a string, Tacl will normalize whitespaces and line breaks both in the actual text and in the expected string before matching. When regular expression is used, the actual text is matched as it is.


To Have Text

Asserts that the element's text exactly matches the given value. All nested elements will be considered when computing the text content of the element. You can use regular expressions for the value as well.

To verify if an element has specific text:

  • Select the To Have Text assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Text

To Have Text Configuration:

  • Expected Text (Mandatory)
    The exact text that the element should contain.

  • Ignore Case (Optional)
    Determines whether the text comparison should ignore case differences.

  • Use Inner Text (Optional)
    When enabled, matches the inner text rather than the entire element text content.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the text content validation.

  • Not (Optional)
    Reverses the assertion to check that the element's text does not match the specified value.

note

When expected text is a string, Tacl will normalize whitespaces and line breaks both in the actual text and in the expected string before matching. When regular expression is used, the actual text is matched as it is.


Attribute Assertions

To Have Attribute

Asserts that an element has a specific attribute.

To verify if an element has a specific attribute:

  • Select the To Have Attribute assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Attribute

To Have Attribute Configuration:

  • Name (Mandatory)
    The name of the attribute that should exist on the element.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the attribute to be validated.

  • Not (Optional)
    Reverses the assertion to check that the element does not have the specified attribute.


To Have Attribute Value

Validates that an attribute of an element has the expected value.

To verify if an element’s attribute has a specific value:

  • Select the To Have Attribute Value assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Attribute Value

To Have Attribute Value Configuration:

  • Name (Mandatory)
    The name of the attribute to validate.

  • Value (Mandatory)
    The expected value of the attribute.

  • Ignore Case (Optional)
    Determines whether the value comparison should ignore case differences.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the attribute value to be validated.

  • Not (Optional)
    Reverses the assertion to check that the attribute does not have the specified value.


To Have Class

Checks if an element has a specified class name.

To verify if an element has a specific class:

  • Select the To Have Class assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Class

To Have Class Configuration:

  • Expected (Mandatory)
    The expected class name that should be present on the element. This needs to be a full match or using a relaxed regular expression.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the class to be validated.

  • Not (Optional)
    Reverses the assertion to check that the element does not have the specified class.


To Have ID

Asserts that an element has the expected id attribute.

To verify if an element has a specific id:

  • Select the To Have ID assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have ID

To Have ID Configuration:

  • ID (Mandatory)
    The expected id value of the element.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the id to be validated.

  • Not (Optional)
    Reverses the assertion to check that the element does not have the specified id.


Count and Value Assertions

To Have Count

Asserts that a collection of elements has the exact specified number of elements.

To verify the count of elements:

  • Select the To Have Count assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Count

To Have Count Configuration:

  • Count (Mandatory)
    The expected number of elements.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the element count validation.

  • Not (Optional)
    Reverses the assertion to check that the element count does not match the specified number.


To Have Value

Checks if an element (such as an input field) has the exact specified value.

To verify if an element has a specific value:

  • Select the To Have Value assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Value

To Have Value Configuration:

  • Value (Mandatory)
    The expected value of the element.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the value to be validated.

  • Not (Optional)
    Reverses the assertion to check that the element does not have the specified value.


To Have Values

Ensures the identifier points to multi-select/combobox (i.e. a select with the multiple attribute) and the specified values are selected.

To verify the values of multiple elements:

  • Select the To Have Values assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Values

To Have Values Configuration:

  • Values (Mandatory)
    The expected value(s) for the elements.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the values to be validated.

  • Not (Optional)
    Reverses the assertion to check that the elements do not have the specified values.


To Have Value Length

Asserts that the length of an element’s value (text content) matches the specified number.

Example Usage: Ensure that a username field has exactly 8 characters.

To verify the length of an element’s value:

  • Select the To Have Value Length assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Value Length

To Have Value Length Configuration:

  • Length (Mandatory)
    The expected length of the element’s value.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the value length to be validated.

  • Not (Optional)
    Reverses the assertion to check that the element’s value length does not match the specified number.\

note

This assertion uses textContent, which includes all text within the element (even hidden text)


To Have Value Greater Than

Asserts that the numeric value of an element’s value (text content) is greater than the specified number.

Example Usage: On a product page, you want to ensure that the displayed price is greater than a minimum threshold (e.g., $50).

To verify that an element's value is greater than a given number:

  • Select the To Have Value Greater Than assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Value Greater Than

To Have Value Greater Than Configuration:

  • Value (Mandatory)
    The number to compare against. The element's value will be converted to a number for the comparison.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the value validation.

  • Not (Optional)
    Reverses the assertion to check that the element's value is not greater than the specified number.

note

This assertion uses textContent, which includes all text within the element (even hidden text), and converts the text content to a number for comparison.


To Have Value Greater Than Or Equal

Asserts that the numeric value of an element’s value (text content) is greater than or equal to the specified number.

Example Usage: On a product page, you want to ensure that the displayed price is greater than or equal to a minimum threshold (e.g., $50).

To Have Value Greater Than

To verify that an element's value is greater than or equal to a given number:

  • Select the To Have Value Greater Than Or Equal assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Value Greater Than Or Equal Configuration:

  • Value (Mandatory)
    The number to compare against. The element's value will be converted to a number for the comparison.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the value validation.

  • Not (Optional)
    Reverses the assertion to check that the element's value is not greater than or equal to the specified number.

note

This assertion uses textContent, which includes all text within the element (even hidden text), and converts the text content to a number for comparison.


To Have Value Less Than

Asserts that the numeric value of an element’s value (text content) is less than the specified number.

Example Usage: In a game or quiz application, you want to verify that the remaining time on a countdown timer is less than a specified limit (e.g., 10 seconds) to trigger a warning or end the game.

To verify that an element's value is less than a given number:

  • Select the To Have Value Less Than assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Value Less Than

To Have Value Less Than Configuration:

  • Value (Mandatory)
    The number to compare against. The element's value will be converted to a number for the comparison.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the value validation.

  • Not (Optional)
    Reverses the assertion to check that the element's value is not less than the specified number.

note

This assertion uses textContent, which includes all text within the element (even hidden text), and converts the text content to a number for comparison.


To Have Value Less Than Or Equal

Asserts that the numeric value of an element’s value (text content) is less than the specified number.

Example Usage: In a game or quiz application, you want to verify that the remaining time on a countdown timer is less than or equal to a specified limit (e.g., 10 seconds) to trigger a warning or end the game.

To verify that an element's value is less than or equal to a given number:

  • Select the To Have Value Less Than Or Equal assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Value Less Than or Equal

To Have Value Less Than Or Equal Configuration:

  • Value (Mandatory)
    The number to compare against. The element's value will be converted to a number for the comparison.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the value validation.

  • Not (Optional)
    Reverses the assertion to check that the element's value is not less than or equal to the specified number.

note

This assertion uses textContent, which includes all text within the element (even hidden text), and converts the text content to a number for comparison.


CSS and Style Assertions

To Have CSS

Asserts that an element has a specific CSS property with a specified value, allowing you to confirm styling directly.

To verify a CSS property and value:

  • Select the To Have CSS assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have CSS

To Have CSS Configuration:

  • Name (Mandatory)
    The CSS property name to validate.

  • Value (Mandatory)
    The expected value of the CSS property.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the CSS property validation.

  • Not (Optional)
    Reverses the assertion to check that the element does not have the specified CSS property value.


Page Assertions

To Have Title

Checks if the page’s title matches the expected value.

To verify the page title:

  • Select the To Have Title assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have Title

To Have Title Configuration:

  • Title or RegExp (Mandatory)
    The expected title or regular expression to match the page title.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the title to be validated.

note

Although this is categorized as a page assertion, it can be applied directly to individual elements present on the page.


To Have URL

Asserts that the page’s URL matches the specified value, allowing you to confirm the user is on the expected page.

To verify the page URL:

  • Select the To Have URL assertion from the assertions list.
  • Enter the assertion name in the Assertion Name field.
  • Click the Add Assertion button to finalize the assertion.

To Have URL

To Have URL Configuration:

  • URL or RegExp (Mandatory)
    The expected URL or regular expression to match the page URL.

  • Ignore Case (Optional)
    Determines whether the URL comparison should ignore case differences.

  • Timeout in milliseconds (Optional)
    Maximum time to wait for the URL to be validated.

note

Although this is categorized as a page assertion, it can be applied directly to individual elements present on the page.


These assertions in Tacl enable thorough and precise validation of web elements in various scenarios, helping ensure reliable automation outcomes.