framework_eng/skills/tool-usage/browser-ui/playwright-interactive/SKILL.md
Use for iterative UI debugging of web applications and Electron through a persistent `js_repl` Playwright session. Helps keep browser handles alive between steps without restarting.
npx skillsauth add steelmorgan/1c-agent-based-dev-framework playwright-interactiveInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Persistent js_repl Playwright session for iterative UI debugging of web and Electron apps. Keep the same handles alive across iterations.
js_repl must be enabled (~/.codex/config.toml: [features] js_repl = true, or --enable js_repl).--sandbox danger-full-access (temporary requirement).js_repl_reset as recovery only. Resetting destroys Playwright handles.test -f package.json || npm init -y
npm install playwright
node -e "import('playwright').then(() => console.log('playwright import ok')).catch((error) => { console.error(error); process.exit(1); })"
For web: npx playwright install chromium. For Electron: npm install --save-dev electron.
references/snippets.md > Bootstrap).All code snippets for session setup are in references/snippets.md.
| Mode | When | Key parameters | Snippet |
|------|------|---------------|---------|
| Desktop web | Default iteration | viewport: { width: 1600, height: 900 } | snippets.md > Desktop Web Context |
| Mobile web | Mobile testing | viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true | snippets.md > Mobile Web Context |
| Native-window web | OS-level DPI, browser chrome validation | viewport: null | snippets.md > Native-Window Web Pass |
| Electron | Desktop app | electronLauncher.launch({ args: [ELECTRON_ENTRY] }) | snippets.md > Electron Session |
Binding rules:
var for top-level Playwright handles (reused across js_repl cells).page, mobilePage, appWindow.undefined and rerun the cell.| Change type | Action |
|-------------|--------|
| Renderer-only | await reloadWebContexts() or await appWindow.reload(...) |
| Main-process, preload, startup | Relaunch Electron (snippets.md > Electron Restart) |
| Uncertain process ownership | Relaunch |
Default: CSS-normalized, JPEG quality 85. All helpers in references/snippets.md > Screenshot Helpers.
| Surface | Default path | Fallback (native-window) |
|---------|-------------|--------------------------|
| Web page | await emitWebJpeg(page) | emitWebScreenshotCssScaled({ page }) |
| Mobile web | await emitWebJpeg(mobilePage) | same with mobilePage |
| Electron | emitElectronScreenshotCssScaled({ electronApp }) | (always main-process path) |
| Raw (fidelity-sensitive only) | surface.screenshot({ type: "jpeg", quality: 85 }) | |
Key rules:
scale: "css" works in native-window mode; Chromium Retina may return device pixels.appWindow.context().newPage() as scratch page.clickCssPoint({ surface, clip, x, y }).Before signoff, verify the intended initial view. Snippet in references/snippets.md > Viewport Fit Check.
getBoundingClientRect()), not just document bounds.Keep the app running in a persistent TTY session. Verify port is listening before page.goto(...). For Electron with a separate dev server (Vite/Next), keep that running first.
Run cleanup cell from references/snippets.md > Cleanup when finished. Exiting Codex does not implicitly run browser.close() or electronApp.close().
page.evaluate(...) inspects state but does not count as signoff input.Cannot find module 'playwright': run one-time setup, verify import.npx playwright install chromium.net::ERR_CONNECTION_REFUSED: dev server running? Recheck port, prefer http://127.0.0.1:<port>.electron.launch hangs: verify electron dep, args target, renderer dev server running.Identifier has already been declared: reuse bindings, new name, or { ... } block.Not supported on browserContext.newPage with Electron: use Electron-specific screenshot path.js_repl timeout: rerun bootstrap, use shorter cells.--sandbox danger-full-access.testing
MUST use BEFORE making a judgment about the cause of a conflict, a test failure, or an artifact dispute. Defines the end-to-end verification method L1→L6 and the classification of the first broken link.
development
MUST use AFTER a work cycle with ≥2 iterations (wrote → error → fixed → success). Provides the retrospective procedure and the format for recording practice/anti-patterns in references/learned-patterns.md or {project}/.context/learned-patterns.md.
tools
MUST use WHEN you are writing reusable knowledge into RLM (pattern / architectural decision / stable domain fact) OR reading it before a non-trivial task/solution in the domain. Provides the breakdown of native-push vs RLM-pull, tools for writing and reading RLM, H-MEM levels, and hygiene.
testing
MUST use WHEN the task is classified as simple (< 20 lines, 1 file, no new metadata objects, no architectural decisions). Provides a short cycle of 3 steps with a guard on the self path and mandatory verify.