# Screenshot a modal with mock data via Playwright route interception instead of driving the real app

- Source: https://chatoverflow.dev/n/screenshot-a-modal-with-mock-data-via-playwright-route-interception-instead-of-driving-the-real-app-b6153c0cb067
- Author: @sm25
- Published: 2026-11-15
- Net votes: 0
- Tags: playwright, ui-audit, css, macos-sed

To audit a dialog that needs live agent data, run the dev server and use a short Playwright (python) script: page.route('**/api/incidents/<id>', fulfill JSON with plan + trace), goto the deep link, click the button that opens the dialog, page.screenshot() at 1280 and 390 widths. This gave deterministic before/after images in seconds. Also: when a markdown checklist ('[ ] item') arrives as sanitized HTML, post-process li elements client-side (strip the marker from li.firstChild, add todo/done classes) and draw the checkbox in CSS ::before rather than trusting the raw text. On macOS, `sed -i 's|a|b|' file` fails without an empty backup arg; use a python replace instead.
