Skip to content

feat(mcp): support python, java and csharp in --codegen - #42106

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:fix-mcp-1696
Aug 4, 2026
Merged

feat(mcp): support python, java and csharp in --codegen#42106
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:fix-mcp-1696

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • --codegen now accepts python, java and csharp in addition to typescript and none
  • tools emit structured actions (@isomorphic/codegen/actions) rendered with the recorder language generators when serializing the response; operations without an action representation keep their JavaScript snippets
  • secrets render as idiomatic environment lookups per language (process.env[...], os.environ[...], System.getenv(...), Environment.GetEnvironmentVariable(...)), with a SECRET_<NAME> placeholder fallback

Fixes microsoft/playwright-mcp#1696

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Tools emit structured actions rendered with the recorder language
generators at serialization time. Operations without an action
representation keep their JavaScript snippets. Secrets render as
idiomatic environment lookups per language.

Fixes: microsoft/playwright-mcp#1696
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-library] › library/video.spec.ts:699 › screencast › should capture full viewport on hidpi `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:177 › serviceWorker(), and fromServiceWorker() work `@realtime-time-library-chromium-linux`
⚠️ [firefox-page] › page/page-goto.spec.ts:90 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node20`

51196 passed, 1188 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [firefox] › mcp/cli-parsing.spec.ts:76 › should preserve leading zeros in string arguments @mcp-windows-latest-firefox

8049 passed, 1284 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures here.

🟡 One MCP failure — uncertain, can't prove it either way

[firefox] › mcp/cli-parsing.spec.ts:76 › should preserve leading zeros in string arguments failed once on mcp-windows-latest-firefox (run 30862424062). The typed value never showed up in the snapshot (Expected substring "0812345679", received "- textbox [ref=e2]"). The tests 1 run is clean — only flaky/interrupted, nothing to triage there.

Details

Overall: the only real failure is a single MCP test on one bot. This PR does touch the tools that test exercises (keyboard.ts/type, snapshot.ts), so I can't wave it off — but the runtime path the test asserts on is unchanged, and I found no prior failure to call it a flake. Net: uncertain.

Uncertain

  • [firefox] › mcp/cli-parsing.spec.ts:76 › should preserve leading zeros in string arguments — the test types 0812345679 and expects it back in the accessibility snapshot; the textbox came back empty, so the fill didn't register on this run.
    • Argument against caused-by-PR: your change to the type tool is emission-onlyresponse.addAction({ name: 'fill', ... }) replaced response.addCode(...). The actual interaction, await locator.fill(secret.value, ...), and the snapshot rendering are byte-identical to main. The assertion is on the DOM value, not on emitted code, so the diff doesn't obviously reach the failing behavior. A real regression here would also be expected to hit chromium/webkit, not one firefox-windows shard.
    • Argument against flake: per the triage hard rule I need the same test failing where the PR can't be responsible, and there isn't any. On mcp-windows-latest-firefox this test is 351/352 green — the one red is this PR's run, and it's green across every other bot (~7000 runs). It has never flaked in the window the DB covers.
    • To be sure: re-run the MCP job on this branch. A pass on retry with no code change would confirm it's a timing flake in fillsnapshot rather than something you introduced.

Run history on mcp-windows-latest-firefox (oldest→newest, last square is this PR):

…🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟥

Triaged by the Playwright bot - agent run

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit 273c8aa into microsoft:main Aug 4, 2026
50 of 51 checks passed
Yury Semikhatsky (yury-s) added a commit to microsoft/playwright-mcp that referenced this pull request Aug 6, 2026
## What's New

### Tool Improvements

- **`browser_take_screenshot` — WebP format** — New `type` option to
pick the image format (`png`, `jpeg` or `webp`); when unset, the format
is inferred from the filename extension
([#41152](microsoft/playwright#41152))
- **`--codegen` — more languages** — Code generation now supports
`python`, `java` and `csharp` in addition to `typescript`
([#42106](microsoft/playwright#42106))
- **Configurable settle delay** — New `--timeout-settle` flag (and
`timeouts.settle` config option) to control how long to wait after each
action for triggered work (navigations, requests) to settle, defaults to
500ms ([#41924](microsoft/playwright#41924))

## Fixes

- Aria snapshot capture is skipped when the response discards it
([#41923](microsoft/playwright#41923))
- New `--snapshot-boxes` flag (and `snapshot.boxes` config option) to
enable bounding boxes in snapshots globally — previously this was only
available per command
([#42102](microsoft/playwright#42102))
- Reconnect to the browser after a disconnect
([#41966](microsoft/playwright#41966))
- Report malformed JSON config instead of silently falling back to INI
parsing ([#41909](microsoft/playwright#41909))
- Clear the dialog modal state when a dialog is closed out of band
([#42032](microsoft/playwright#42032))
- Detect downloads via the download event instead of guessing from
`net::ERR_ABORTED` navigation errors
([#41933](microsoft/playwright#41933))
- Surface the missing executable path when a browser isn't installed
([#41941](microsoft/playwright#41941))
- Escape user input in codegen output
([#41962](microsoft/playwright#41962))
- Removed the stale `--output-mode` CLI option
([#41833](microsoft/playwright#41833))

### Browser Extension

- Validate `Host` and `Origin` headers on CDP relay WebSocket upgrades
([#42103](microsoft/playwright#42103))
- Launch the Chrome profile that has the extension installed
([#41939](microsoft/playwright#41939))
- Pass `noDefaults` for extension CDP connections
([#42119](microsoft/playwright#42119))
- Mention `PLAYWRIGHT_MCP_EXECUTABLE_PATH` in the error shown when the
browser executable is not found
([#42122](microsoft/playwright#42122))
- Removed support for extension protocol v1
([#41857](microsoft/playwright#41857))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Java, Python code as options with --codegen

2 participants