{
  "schema_version": 1,
  "name": "Click with a backup selector",
  "version": 1,
  "description": "Try to click the primary button; if the page changed its label, fall back to a backup label instead of failing the whole run. This is per-block error handling — a resilient pattern for sites that A/B-test their UI.",
  "tags": ["resilience", "error-handling"],
  "vars": {
    "url": "https://example.com",
    "primary_button": "Continue",
    "backup_button": "Next"
  },
  "on_error": "screenshot_and_stop",
  "steps": [
    { "open": {} },
    { "goto": { "url": "{{url}}" } },
    { "try": {},
      "do": [ { "click": { "text": "{{primary_button}}" } } ],
      "fallback": [ { "click": { "text": "{{backup_button}}" } } ] },
    { "wait": { "seconds": 2 } },
    { "screenshot": { "path": "after-click.png" } },
    { "close": {} }
  ]
}
