Skip to content

Add Playwright install and usage recipe for JS-rendered APIs #3462

Description

@TerraFarmr

Filed by /printing-press-retro from a run of TNSTC OTRS
(scorecard Not formally run, Build + live smoke tests passed).

Summary

When extracting JavaScript-rendered content, the agent needed to install Playwright (pip3 install playwright, python3 -m playwright install chromium) but struggled with missing guidance. The install requires --break-system-packages on Debian-based systems, and the agent didn't know whether to use expect_navigation or response interception for AJAX calls, leading to timeout errors. Providing the correct Linux install incantation and basic usage patterns would eliminate this recurring friction.

Where to look

  • Component: skill
  • Likely area: skills/printing-press/SKILL.md — new ## JS-rendered APIs section
  • Triggered when: A portal or SPA requires JavaScript execution to render key data (e.g., seat layouts), forcing the agent to use Playwright or a similar headless browser via Python scripting.

What we observed

The agent spent significant time installing and debugging Playwright:

  • First pip install failed with a Debian PEP 668 constraint (--break-system-packages missing).
  • tnstc_seats.py needed ~4 rewrites because the agent incorrectly used expect_navigation instead of page.on("response", ...) interception for Struts AJAX calls.

Suspected root cause

The skill lacks guidance on secondary scripting languages (Python/Playwright) as escape valves for JS-rendered responses, leaving the agent to reason through installation and usage patterns independently.

Suggested direction

Add a ## JS-rendered APIs: Playwright recipe section covering:

  1. Decision heuristic: Try pure HTTP first; fall back to Playwright only if JS-rendered.
  2. Correct install on Linux root (pip3 install playwright --break-system-packages && python3 -m playwright install chromium).
  3. The async/context manager pattern.
  4. Response interception pattern for AJAX endpoints instead of waiting for navigation.

Acceptance criteria

  • positive: Agent building a JS-rendered portal CLI installs Playwright on the first try with correct flags and uses response interception for AJAX endpoints.
  • negative: The recipe is gated on JS rendering detection; normal REST CLI workflows are unaffected.

Frequency

subclass:js-rendered-portal

Complexity

small

Scope boundary

Linux/macOS only (Windows out of scope). Python Playwright only (Node.js Playwright out of scope).

Dependencies

None.

Artifacts

Artifact Link
Retro document Upload failed — see local copy
Manuscripts (research + proofs) Upload failed — see local copy
Generated CLI source code Upload failed — see local copy

Generated by /printing-press-retro · CLI Printing Press

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions