{
  "schema_version": 1,
  "name": "Scrape a paginated list",
  "version": 1,
  "description": "Load a list page, then keep clicking \"Load more\" until it disappears (a while-loop), reading the items each round. Point list_url and the button/marker text at your target. Nothing is submitted — this only reads.",
  "vars": {
    "list_url": "https://example.com/list",
    "load_more": "Load more",
    "end_marker": "No more results"
  },
  "on_error": "screenshot_and_stop",
  "steps": [
    { "open": {} },
    { "goto": { "url": "{{list_url}}" } },
    { "wait_for": { "text": "{{load_more}}", "timeout": 15 } },
    { "while": { "element_present": "{{load_more}}", "max": 100 },
      "do": [
        { "read": { "into": "page_text" } },
        { "click": { "text": "{{load_more}}" } },
        { "wait": { "seconds": 2 } },
        { "if": { "text_present": "{{end_marker}}" },
          "then": [ { "stop": { "reason": "reached the end of the list" } } ] }
      ] },
    { "screenshot": { "path": "list-done.png" } },
    { "close": {} }
  ]
}
