Capture Screenshot

Command value: screenshot

Captures a screenshot of the page, or of one element, at this point in the test.

Fields

FieldJSON propertyDescription
Element Selector (Optional)targetCSS selector or XPath of an element to capture. Leave blank to capture the full page.

Usage

  • Screenshots are attached to the run result.
  • The final screenshot of a run is used for visual comparison against the approved baseline.

Example step (JSON)

{
  "command": "screenshot"
}

Playwright equivalent

await page.screenshot({ path: 'screenshot-step-4.png' });

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.