Element text contain

Command value: assertTextPresent

Passes when the element text contains the expected text.

Fields

FieldJSON propertyDescription
CSS or XPath SelectortargetElement the step acts on, for example #login, .cart button or //button[text()='Save'].
Expected TextvalueText to compare against the element text. Variables are supported.

Usage

  • Matches a substring of the visible element text. The match is case-sensitive.
  • Expected text may include variables, for example Welcome {{USERNAME}}.

Example step (JSON)

{
  "command": "assertTextPresent",
  "target": ".toast",
  "value": "Saved"
}

Playwright equivalent

await expect(page.locator('.toast')).toContainText('Saved');

Common options

  • Make this step optional (Continue on failure): when checked, a failure in this step is recorded and the test continues with the next step.
  • Execute step when JavaScript returns true: runs the step only when the JavaScript condition returns true. Otherwise the step is skipped.

See conditional steps and variables for details.