.. _rf-capture: Robot Framework Capture ======================= The Robot Framework capture pipeline lets you build Guidestar demos from any live web application — including JavaScript SPAs on external origins that cannot be loaded via ``htmlSrc`` — without modifying the application itself. Instead of injecting the live page at view time, the pipeline: 1. **Drives a real Chromium browser** (via Playwright) at build time. 2. **Intercepts API calls** with mock responses using Playwright's ``page.route()`` — at the network layer, not the JS layer, so it works regardless of whether the app uses ``fetch``, XHR, Axios, or WebSocket. 3. **Captures the page state** at each marked step as either a full-viewport screenshot or a cleaned DOM snapshot. 4. **Writes a static wireframe** HTML file plus a Guidestar JSON demo config. The result feeds directly into the existing ``guidestar-build`` pipeline. Readers of the documentation never contact the live application. When to use this ---------------- .. list-table:: :header-rows: 1 :widths: 30 35 35 * - Approach - Best for - Limitations * - :doc:`manual` - Full design control; complex interactions - Must be maintained as UI evolves * - :doc:`live-url` - Simple, same-origin, ``fetch``-based pages - Cannot load external SPAs; CORS restriction * - :doc:`ai-assisted-url` - Quick wireframe from a URL via AI - Requires AI agent; no real interactivity * - **Robot Framework Capture** *(this page)* - Complex SPAs, external origins, real API mocking - Requires Playwright + RF at build time; screenshots are not interactively element-selectable in Guidestar cursor mode Installation ------------ Install the ``capture`` extras and the Chromium browser: .. code-block:: bash pip install "sphinx-guidestar[capture]" playwright install chromium This adds two new dependencies to the existing environment: * `Playwright `_ (already required by ``guidestar-record`` for GIF recording) * `Robot Framework `_ ≥ 6.0 Capture modes ------------- Both modes are available via the ``capture_mode`` Library argument (or the ``--mode`` CLI flag): .. list-table:: :header-rows: 1 :widths: 20 40 40 * - Mode - What is captured - Notes * - ``screenshot`` *(default)* - Full-viewport PNG at each step, base64-embedded in the wireframe. - Always works regardless of origin or SPA complexity. Guidestar cursor targets the root container, not individual UI elements. * - ``dom`` - Live DOM serialised via ``page.content()``. External stylesheets are fetched and inlined; external images become data URIs; ``