Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser_navigate fails in headless mode with "Browser window not found" error #48

Open
takatea opened this issue Mar 27, 2025 · 4 comments
Assignees
Labels

Comments

@takatea
Copy link

takatea commented Mar 27, 2025

Problem Summary

When running Playwright MCP in headless mode, the server initializes successfully, but the browser_navigate command fails with a "Browser window not found" error, preventing browser automation.

Steps to Reproduce

  1. Configure Playwright MCP with the following settings:
{
  "playwright": {
    "command": "npx",
    "args": ["@playwright/mcp@latest", "--headless"]
  }
}
  1. The server starts successfully (confirmed in logs)
  2. When executing browser_navigate, the operation fails with an error

Error Message

Error: browserType.launchPersistentContext: Protocol error (Browser.getWindowForTarget): Browser window not found

Expected Behavior

  • The browser_navigate command should work successfully in headless mode, allowing navigation to URLs

Actual Behavior

  • The browser_navigate command fails with a "Browser window not found" error, making it impossible to navigate to URLs

Environment Information

  • OS: macOS 14.4.1
  • Node.js version: v18.16.1
  • @playwright/mcp version: 0.0.4
  • Playwright version: v1.51.1

Log

2025-03-27T08:51:27.026Z [playwright] [info] Message from client: {"method":"tools/call","params":{"name":"browser_navigate","arguments":{"url":"https://www.google.com/search?q=platwrite+mcp"}},"jsonrpc":"2.0","id":10}
2025-03-27T08:51:27.950Z [playwright] [info] Message from server: {"jsonrpc":"2.0","id":10,"result":{"content":[{"type":"text","text":"Error: browserType.launchPersistentContext: Protocol error (Browser.getWindowForTarget): Browser window not found\nCall log:\n  - <launching> /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AutoExpandDetailsElement,AvoidUnnecessaryBeforeUnloadCheckSync,CertificateTransparencyComponentUpdater,DeferRendererTasksAfterInput,DestroyProfileOnBrowserClose,DialMediaRouteProvider,ExtensionManifestV2Disabled,GlobalMediaControls,HttpsUpgrades,ImprovedCookieControls,LazyFrameLoading,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --enable-use-zoom-for-dsf=false --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/Users/takatea/Library/Caches/ms-playwright/mcp-chrome-profile --remote-debugging-pipe about:blank\n  - <launched> pid=83786\n"}],"isError":true}}
@pavelfeldman
Copy link
Member

pavelfeldman commented Mar 28, 2025

Works for me (same config as yours). What is your Chrome version?

Image

@takatea
Copy link
Author

takatea commented Mar 29, 2025

@pavelfeldman My Chrome version is 134.0.6998.166.

Image

@Skn0tt
Copy link
Member

Skn0tt commented Mar 31, 2025

I've seen this in the past, I think it's related to multiple tabs being opened.

@Skn0tt Skn0tt self-assigned this Mar 31, 2025
@takatea
Copy link
Author

takatea commented Apr 1, 2025

@Skn0tt Hi,
I tried without opening multiple tabs, but the issue persists.
I also attempted to run the command line that appears in the logs:

Command
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AutoExpandDetailsElement,AvoidUnnecessaryBeforeUnloadCheckSync,CertificateTransparencyComponentUpdater,DeferRendererTasksAfterInput,DestroyProfileOnBrowserClose,DialMediaRouteProvider,ExtensionManifestV2Disabled,GlobalMediaControls,HttpsUpgrades,ImprovedCookieControls,LazyFrameLoading,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --enable-use-zoom-for-dsf=false --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/Users/takatea/Library/Caches/ms-playwright/mcp-chrome-profile --remote-debugging-pipe

And received this error:

[0401/135126.005324:ERROR:chrome_main_delegate.cc(1090)] Remote debugging pipe file descriptors are not open.

Could this error be related to the issue? The debug pipe seems to be a problem.
If there's anything else I can do to help troubleshoot this issue, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants