How to capture human user actions in a Playwright MCP browser session?
I'm using microsoft/playwright-mcp with a VS Code extension. I want to record what a human does inside the browser the MCP server opens (clicks, typing, navigating) and export it as a trace, but --save-trace only records the actions the MCP server itself takes through its tools. Is there a configuration that captures both user interactions and the usual trace data (network, console, screenshots)?
Originally asked on GitHub: https://github.com/microsoft/playwright-mcp/issues/734
4 answers
Resolved: the maintainer (Pavel Feldman) confirmed that running the server with
--save-sessionrecords user interactions and snapshots. In follow-up testing, combining--save-sessionwith--save-traceproduced a trace.zip containing screenshots, HTTP requests/responses, and console logs, plus a session.md file that timestamps the user's actions, so you can correlate the human steps with the trace by time.Two caveats from the thread: user interactions are recorded in session.md, not embedded in trace.zip itself, and DOM snapshots (HTML/CSS/JS) are not included. Also, a bug was logged at issue #1007 where
--save-sessionstopped working after about 7-8 actions. No version number was mentioned in the thread, so check your installed playwright-mcp release for the--save-sessionflag.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Ran playwright-mcp with --save-trace expecting to see human clicks and typing in the trace. It only showed the actions the MCP server performed through its tools, not what the human did in the browser.
Source: https://github.com/microsoft/playwright-mcp/issues/734 (opens external site)
Did this work for you?What @pavelfeldman tried on GitHub (Worked)
A maintainer suggested running the server with --save-session to record user interactions and snapshots, which should provide enough information to generate tests.
Source: https://github.com/microsoft/playwright-mcp/issues/734#issuecomment-3259958138 (opens external site)
Did this work for you?What @danielmhair tried on GitHub (Partly worked)
Tested --save-trace combined with --save-session. Got screenshots, HTTP requests/responses, and console logs; session.md records user actions with timestamps, but user interactions are not embedded in trace.zip, and testing could not go past 7-8 actions due to issue #1007.
Source: https://github.com/microsoft/playwright-mcp/issues/734#issuecomment-3267118313 (opens external site)
Did this work for you?
Related questions
- Playwright MCP browser_take_screenshot shows no saved file or unreadable image in Cursor or VS Code
- Windows: playwright-mcp via Claude Desktop fails: Chromium distribution 'chrome' is not found
- playwright-mcp fails to start in Cursor after 0.0.19/0.0.20 (Client closed / Connection closed)
- Can I generate codegen-style Playwright test code from a prompt-driven playwright-mcp flow?
- Does Playwright MCP have a quiet mode to reduce page snapshot tokens?