Element text does not equals

Command value: assertNotText

Passes when the element text does not equal 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

  • Compares the full visible element text exactly, including case. Use a contains assertion for partial matches.
  • Expected text may include variables, for example Welcome {{USERNAME}}.

Example step (JSON)

{
  "command": "assertNotText",
  "target": ".cart-count",
  "value": "0"
}

Playwright equivalent

await expect(page.locator('.cart-count')).not.toHaveText('0');

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.