clear_codegen_session
Clear a code generation session without generating a test
Drive a browser and the API behind it in one session, and leave with a Playwright test for what you did.
LABSCO SUMMARY
A codegen session brackets whatever you did in between and produces a Playwright test file from it, so a bug reproduced by hand leaves a regression test rather than a paragraph in a ticket. The HTTP verbs sitting beside the browser calls mean state can be set up through the API and then checked in the UI.
Playwright behind an agent interface: navigation and interaction by CSS selector including inside iframes, page content as text or cleaned HTML, direct HTTP verbs alongside the browser, response assertions, and a codegen session that writes the test file for whatever happened between start and end.
Node, run over stdio from npm as @executeautomation/playwright-mcp-server through npx, or built from a clone and linked locally. Browser tools need the Playwright browser binaries: the server downloads a missing browser the first time a tool asks for it, and npx playwright install fetches them ahead of time. The HTTP verbs work without them. Calls take CSS selectors, so you need the page's markup; playwright_get_visible_html will fetch it if you do not have it. The API side does not yet cover OAuth, multipart forms or binary bodies.
One command — npm install -g @executeautomation/playwright-mcp-server
USE CASES
Open a codegen session, reproduce the bug through the browser, and end the session — the test file is the output of the investigation.
Address the frame and the element separately, so an embedded payment or consent widget is reachable rather than a dead end.
Create the record with a POST carrying your bearer token, then load the page and read the visible text to confirm it shows.
Register the wait for the response before the action, take the action, then assert on what came back.
Resize with a device preset so the user agent, scale factor and touch behaviour change together, then capture the screenshot.
Read the console filtered to errors, run a snippet in the page to inspect state, and take the cleaned HTML for the selector you suspect.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
clear_codegen_sessionClear a code generation session without generating a test
end_codegen_sessionEnd a code generation session and generate the test file
get_codegen_sessionGet information about a code generation session
playwright_assert_responseWait for and validate a previously initiated HTTP response wait operation.
playwright_clickClick an element on the page
playwright_click_and_switch_tabClick a link and switch to the newly opened tab
playwright_closeClose the browser and release all resources
playwright_console_logsRetrieve console logs from the browser with filtering options
playwright_custom_user_agentSet a custom User Agent for the browser
playwright_deletePerform an HTTP DELETE request
playwright_dragDrag an element to a target location
playwright_evaluateExecute JavaScript in the browser console
playwright_expect_responseAsk Playwright to start waiting for a HTTP response. This tool initiates the wait operation but does not wait for its completion.
playwright_fillfill out an input field
playwright_getPerform an HTTP GET request
playwright_get_visible_htmlGet the HTML content of the current page. By default, all <script> tags are removed from the output unless removeScripts is explicitly set to false.
playwright_get_visible_textGet the visible text content of the current page
playwright_go_backNavigate back in browser history
playwright_go_forwardNavigate forward in browser history
playwright_hoverHover an element on the page
playwright_iframe_clickClick an element in an iframe on the page
playwright_iframe_fillFill an element in an iframe on the page
playwright_navigateNavigate to a URL
playwright_patchPerform an HTTP PATCH request
playwright_postPerform an HTTP POST request
playwright_press_keyPress a keyboard key
playwright_putPerform an HTTP PUT request
playwright_resizeResize the browser viewport using manual dimensions or device presets. Supports 143+ device presets including iPhone, iPad, Android devices, and desktop browsers with proper user-agent and touch emulation.
playwright_save_as_pdfSave the current page as a PDF file
playwright_screenshotTake a screenshot of the current page or a specific element
playwright_selectSelect an element on the page with Select tag
playwright_upload_fileUpload a file to an input[type='file'] element on the page
start_codegen_sessionStart a new code generation session to record Playwright actions
BEFORE YOU INSTALL
33 tools when we connected. The documentation writes some names with a capital Playwright_ prefix; the server registers every name in lower case, such as playwright_navigate. The 143 device presets are values for playwright_resize, not tools.
npx on PATH
CONTEXT COST
Rated by the size of the 33 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npm install -g @executeautomation/playwright-mcp-server{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"-y",
"@executeautomation/playwright-mcp-server"
]
}
}
}The first time a browser tool needs a browser that is missing, the server downloads and installs it (Chromium, Firefox or WebKit) and retries the request. To install them ahead of time, or if the automatic install fails, run npx playwright install — or npx playwright install chromium for one browser.
claude mcp add --transport stdio playwright npx @executeautomation/playwright-mcp-serverThe first time a browser tool needs a browser that is missing, the server downloads and installs it (Chromium, Firefox or WebKit) and retries the request. To install them ahead of time, or if the automatic install fails, run npx playwright install — or npx playwright install chromium for one browser.
npx @michaellatman/mcp-get@latest install @executeautomation/playwright-mcp-serverThe first time a browser tool needs a browser that is missing, the server downloads and installs it (Chromium, Firefox or WebKit) and retries the request. To install them ahead of time, or if the automatic install fails, run npx playwright install — or npx playwright install chromium for one browser.
code-insiders --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'The first time a browser tool needs a browser that is missing, the server downloads and installs it (Chromium, Firefox or WebKit) and retries the request. To install them ahead of time, or if the automatic install fails, run npx playwright install — or npx playwright install chromium for one browser.