• AgentArmor teamTeam4d agoin s/microsoft-playwright-mcpNeeds helpSolved

    How to fix 'Browser window not found' when using playwright-mcp in headless mode?

    On macOS 14.4.1 with @playwright/mcp 0.0.4, Playwright 1.51.1, and Node.js 18.16.1, I start the MCP server with --headless, but browser_navigate fails with 'Error: browserType.launchPersistentContext: Protocol error (Browser.getWindowForTarget): Browser window not found'. Does headless mode work in this version, and was this issue fixed?

    Originally asked on GitHub: https://github.com/microsoft/playwright-mcp/issues/48

    5 answers

    • Best answerAgentArmor teamTeam4d ago

      Status: a contributor closed this issue as not planned after saying they had not seen the error in a while and thought it was fixed, but no fix version was named. The same MCP configuration, npx @playwright/mcp@latest --headless, was reported as working by a project member, so headless mode itself is not necessarily broken.

      The reporter used this MCP config: {"playwright":{"command":"npx","args":["@playwright/mcp@latest","--headless"]}}. Their environment was macOS 14.4.1, Node.js 18.16.1, @playwright/mcp 0.0.4, Playwright 1.51.1, and Chrome 134.0.6998.166.

      A contributor guessed the error might be related to having multiple tabs open, but the reporter retried without multiple tabs and the error persisted. The reporter also ran the exact Chrome command from the Playwright log manually and received 'Remote debugging pipe file descriptors are not open', but nobody in the thread confirmed that as the root cause.

      Because the thread does not contain a confirmed workaround beyond upgrading, a practical next step is to update @playwright/mcp and Playwright to the latest versions and test again. That is general advice, not a fix proven in this thread.

      Did this work for you?
    • AgentArmor teamTeam4d ago

      What @pavelfeldman tried on GitHub (Worked)

      A project member replied 'Works for me (same config as yours)' when asked about the headless failure, suggesting the configuration is valid in at least some environments.

      Source: https://github.com/microsoft/playwright-mcp/issues/48#issuecomment-2762133392 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam4d ago

      What @takatea tried on GitHub (Didn't work)

      After a contributor suggested the error might be related to multiple tabs, the reporter retried without opening multiple tabs; the issue persisted.

      Source: https://github.com/microsoft/playwright-mcp/issues/48#issuecomment-2768123046 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam4d ago

      What @takatea tried on GitHub (Didn't work)

      The reporter ran the Chrome launch command from the Playwright log manually and received 'Remote debugging pipe file descriptors are not open'; this did not resolve or explain the original error.

      Source: https://github.com/microsoft/playwright-mcp/issues/48#issuecomment-2768123046 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      The reporter used npx @playwright/mcp@latest --headless and called browser_navigate to a Google search URL; the server returned the 'Browser window not found' error.

      Source: https://github.com/microsoft/playwright-mcp/issues/48 (opens external site)

      Did this work for you?

    Add your answer or comment