Skip to content

Verify Presence of Substring: VERIFYCONTAINS

The Verify Presence of Substring action checks if a specific text or number is present within a larger value. This action is useful for verifying that a particular word, phrase, or number appears within a given text. The left-hand side (LHS) value is taken from an element on the screen, while the right-hand side (RHS) value is entered in the parameter section. The RHS can be a hard-coded value or a variable. If a locator (page and element) is provided, the LHS will be the text found at that locator.

Example 1: Validate presence of a keyword in displayed text.

Scenario: Let’s verify that the Order Details section on a receipt page contains the word “Confirmed.”

Steps to configure:

  1. Add a new step.
  2. Select Verify Presence Of Substring from the Action drop-down.
  3. In the Screen Name field, select the screen where the LHS element is located (e.g., Receipt Page).
  4. In the Element Key field, select the element representing the LHS value (e.g., Order Details).
  5. In the Parameters section, enter the RHS value you want to check for presence (e.g., “Confirmed”).
  6. Click Save.

Note: While the steps for adding an action command are identical in both views, the display of the steps changes:

scrn-Verify-Presence-of-Substring-tabular-view
Tabular View
scrn-Verify-Presence-of-Substring-Card-View
Card View

Note: Ensure that the Screen Name and Element Key are set up before using this action.

Expected Outcome on execution:

  • The Verify Presence of Substring action will check if the LHS value (e.g., the text in Order Details) contains the RHS value (e.g., “Confirmed”).
  • If the substring is found, the action will pass, indicating the expected content is present.
  • If the substring is not found, the action will fail, signaling that the expected content is missing.

Example 2: Check if a specific phrase/text is present in a given string

Scenario: You want to check if the phrase “Your payment” appears in a system-generated message.

Steps to configure:

  1. Add a new step.
  2. Select Verify Presence of Substring from the Action drop-down.
  3. Leave the Screen Name field blank.
  4. In the Element Key field, enter the full LHS value (e.g., Your payment was successful).
  5. In the Parameters section, enter the RHS value to verify (e.g., Your payment).
  6. Click Save.

Note: While the steps for adding an action command are identical in both views, the display of the steps changes:

scrn-Verify-Presence-of-Substring-phrase-tabular-view
Tabular View
scrn-Verify-Presence-of-Substring-phrase-card-view
Card View

Expected Outcome on Execution:

  • The action will check if the LHS value contains the RHS substring.
  • If found, the step will pass, confirming the expected content is present.
  • If not found, the step will fail, indicating a mismatch.

Back To Top