Overview

The Check Text step allows you to verify the text content of elements on your page. It supports both positive assertions (element contains text) and negative assertions (element does not contain text), with options to use variables assigned from previous steps.

Form Fields

Field NameTypeRequiredDescription
LocatorstringYesCSS selector for the element to check
Expected Texttext/dropdownYesText to verify, or selection from variables declared in previous steps
Use variables ToggletoggleNoUse variables from previous steps instead of manual entry
Assertion TypetoggleNoElement has text (default) vs Element does not have text

Form Configuration

Locator Field

  • Text input field for entering CSS selectors
  • Supports element picker for visual selection
  • Should target the element containing the text to verify

Expected Text Options

The form provides two input modes:

Manual Text Entry (Default)

  • Expected Text: Standard text input field
  • Supports environment variables using {{VARIABLE_NAME}} syntax
  • Enter the exact text you expect to find in the element

Use Variables

  • Use variables Toggle: Enable to show dropdown of assigned values
  • Expected Text: Dropdown showing variables from previous steps
  • Available when you have declared variables in previous steps (Extract Value, Run JavaScript, API Request, etc.)

Assertion Type Toggle

  • Element has text (default, toggle enabled): Verifies the element contains the specified text
  • Element does not have text (toggle disabled): Verifies the element does NOT contain the specified text

Examples

Basic Text Verification

  • Locator: .welcome-message
  • Expected Text: Welcome back, John!
  • Use variables Toggle: Disabled
  • Assertion Type: Element has text

Verify Text Does Not Exist

  • Locator: .error-container
  • Expected Text: Network error
  • Use variables Toggle: Disabled
  • Assertion Type: Element does not have text

Using Environment Variables

  • Locator: .username-display
  • Expected Text: {{EXPECTED_USERNAME}}
  • Use variables Toggle: Disabled
  • Assertion Type: Element has text

Using Assigned Variables

  • Locator: .confirmation-message
  • Use variables Toggle: Enabled
  • Expected Text: generatedOrderId (from dropdown of assigned variables)
  • Assertion Type: Element has text

Verify Error Message Absence

  • Locator: .validation-errors
  • Expected Text: Invalid input
  • Use variables Toggle: Disabled
  • Assertion Type: Element does not have text

Best Practices

Locator Selection

  • Use specific, stable CSS selectors that target the text-containing element
  • Prefer data-testid attributes for better test stability
  • Ensure the locator targets the element with the actual text content

Text Matching

  • Use exact text matches when possible for precise verification
  • Consider partial text matching for dynamic content
  • Be aware that text matching is case-sensitive

Assertion Strategy

  • Use “Element has text” for positive verification (confirming expected content)
  • Use “Element does not have text” for negative verification (confirming absence of errors, etc.)
  • Consider whitespace and formatting when matching text

Assigned Variables Usage

  • Use Use variables Toggle to verify dynamic content assigned in previous steps
  • Ensure the variable assignment step executed successfully before the verification
  • Useful for verifying generated IDs, calculated values, or API responses

Common Issues

Element Not Found

  • Verify the element exists and is visible on the page
  • Check that the locator correctly targets the text-containing element
  • Ensure any parent containers or dynamic content has loaded

Text Mismatch

  • Confirm the expected text matches exactly (case-sensitive)
  • Check for extra whitespace, line breaks, or formatting
  • Verify the element contains the text vs. having it as an attribute

Timing Issues

  • Add wait conditions for elements that load text dynamically
  • Ensure text content is fully loaded before verification
  • Handle cases where text updates after initial page load

Supatest Variables Issues

  • Use variables Toggle only appears when you have declared variables in previous steps
  • Ensure the variable assignment step completed successfully
  • Verify the variable name exists and contains the expected value