Element text does not contain
Command value: assertTextNotPresent
Passes when the element text does not contain the expected text.
Fields
| Field | JSON property | Description |
|---|---|---|
| CSS or XPath Selector | target | Element the step acts on, for example #login, .cart button or //button[text()='Save']. |
| Expected Text | value | Text 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": "assertTextNotPresent",
"target": "body",
"value": "Internal Server Error"
}Playwright equivalent
await expect(page.locator('body')).not.toContainText('Internal Server Error');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.