Skip to content

fix(mcp): propagate --browser channel on --extension path#40567

Merged
yury-s merged 2 commits intomicrosoft:mainfrom
yury-s:fix-1589
May 1, 2026
Merged

fix(mcp): propagate --browser channel on --extension path#40567
yury-s merged 2 commits intomicrosoft:mainfrom
yury-s:fix-1589

Conversation

@yury-s
Copy link
Copy Markdown
Member

@yury-s yury-s commented May 1, 2026

Summary

  • The extension server backend called createBrowser, a thin wrapper that passed {} as cliOptions to createBrowserWithInfo. resolveChannelForExtension({}) ignored --browser and fell back to chrome, so e.g. --extension --browser chrome-beta silently spawned regular Chrome with Chrome's user-data-dir.
  • Inline the wrapper at the call sites so the extension path threads the actual CLIOptions through, and drop the now-redundant extension-specific server backend in program.ts — the unified factory already does the right thing.
  • Add a regression test asserting --browser=chrome-dev --extension resolves to the chrome-dev default user-data-dir (visible in the "Playwright Extension not found" error).

Fixes microsoft/playwright-mcp#1589

The extension server backend called createBrowser(config, clientInfo),
a thin wrapper that passed {} as cliOptions to createBrowserWithInfo.
resolveChannelForExtension({}) then ignored the parsed --browser flag
and fell back to "chrome", so e.g. --extension --browser chrome-beta
silently spawned regular Chrome with Chrome's user-data-dir.

Inline the wrapper at the two call sites so the extension path threads
the actual CLIOptions through.

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

This comment has been minimized.

Comment thread packages/playwright-core/src/tools/mcp/program.ts Outdated
Adds a regression test that asserts --browser=chrome-dev --extension
resolves to the chrome-dev default user-data-dir (visible in the
"Playwright Extension not found" error). Also drops the now-redundant
extension-specific server backend in program.ts: the unified factory
already threads CLIOptions into createBrowserWithInfo and works for
the extension path.

The cli-cdp.spec.ts CDP-channel cases are switched from chrome-canary
to chrome-dev to keep the channel choice consistent across MCP tests.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Test results for "MCP"

2 failed
❌ [chrome] › mcp/dashboard.spec.ts:265 › should cancel browser_annotate when the MCP request is aborted @mcp-windows-latest-chrome
❌ [chromium] › mcp/dashboard.spec.ts:325 › should switch screencast to -s session on show --annotate @mcp-windows-latest-chromium

6861 passed, 1015 skipped


Merge workflow run.

@yury-s yury-s merged commit 0c04e83 into microsoft:main May 1, 2026
16 of 18 checks passed
@yury-s yury-s deleted the fix-1589 branch May 1, 2026 18:41
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.

--browser flag silently dropped on --extension path; cliOptions={} in createBrowser → always defaults to chrome

2 participants