You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm the Playwright bot and I took a first look at this.
Both of these are already possible today with the Playwright MCP server (npx playwright run-mcp-server / @playwright/mcp) — it's not the classic npx playwright codegen recorder, but it covers the two things you're asking for.
Codegen in MCP: every browser action the agent takes comes back with a "Ran Playwright code" section containing the generated Playwright code. It's on by default (TypeScript), and you pick the language with --codegen <typescript|python|java|csharp|none>. On top of that, the @playwright/test MCP backend has a dedicated test-generation flow — generator_setup_page → generator_read_log → generator_write_test — that records what happened and writes a real spec file.
Attaching to the extension: the MCP server can drive a running Chrome/Edge via --extension (needs the "Playwright Extension" installed). So you get the "attach to my real browser and generate code" workflow, just from the MCP side rather than the codegen CLI.
Where this lives in the source
--codegen option and the "Ran Playwright code" rendering: packages/playwright-core/src/tools/backend/codegen.ts and response.ts (config field codegen?: 'typescript' | 'python' | 'java' | 'csharp' | 'none').
Test generator tools: packages/playwright/src/mcp/test/generatorTools.ts.
--extension (attach to a running Edge/Chrome via the Playwright Extension): packages/playwright-core/src/tools/mcp/program.ts.
So the "codegen for MCP" ask is largely covered. The one genuinely new thing here would be teaching the standalone npx playwright codegen recorder to attach to the extension the same way MCP does — worth clarifying whether that specific UI is what you're after, or whether the MCP --codegen / generator flow already gets you what you need.
I want Playwright to attach to my existing Chrome tab, record what I do, wait for me to tell it I'm finished, and then generate a sequence of playwright commands reflecting my actions.
Activity
github-actions commentedon Aug 20, 2026
Hi, I'm the Playwright bot and I took a first look at this.
Both of these are already possible today with the Playwright MCP server (
npx playwright run-mcp-server/@playwright/mcp) — it's not the classicnpx playwright codegenrecorder, but it covers the two things you're asking for.--codegen <typescript|python|java|csharp|none>. On top of that, the@playwright/testMCP backend has a dedicated test-generation flow —generator_setup_page→generator_read_log→generator_write_test— that records what happened and writes a real spec file.--extension(needs the "Playwright Extension" installed). So you get the "attach to my real browser and generate code" workflow, just from the MCP side rather than thecodegenCLI.Where this lives in the source
--codegenoption and the "Ran Playwright code" rendering:packages/playwright-core/src/tools/backend/codegen.tsandresponse.ts(config fieldcodegen?: 'typescript' | 'python' | 'java' | 'csharp' | 'none').packages/playwright/src/mcp/test/generatorTools.ts.--extension(attach to a running Edge/Chrome via the Playwright Extension):packages/playwright-core/src/tools/mcp/program.ts.So the "codegen for MCP" ask is largely covered. The one genuinely new thing here would be teaching the standalone
npx playwright codegenrecorder to attach to the extension the same way MCP does — worth clarifying whether that specific UI is what you're after, or whether the MCP--codegen/ generator flow already gets you what you need.Triaged by the Playwright bot - agent run
lowlyocean commentedon Aug 20, 2026
I want Playwright to attach to my existing Chrome tab, record what I do, wait for me to tell it I'm finished, and then generate a sequence of playwright commands reflecting my actions.
feat(mcp): add start/stop recording commands
feat(mcp): add start/stop recording commands
feat(mcp): add start/stop recording commands