You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Internal locator('body') strict-mode check crashes every tool call on pages with malformed nested <body> markup #42100
on any page whose HTML has more than one element in the DOM (in our case,
a real-world SaaS app with invalid nested ... markup
in its page template — confirmed via a standalone Playwright script, independent
of playwright-mcp, that document.querySelectorAll('body') returns 2 connected
nodes on the affected page).
browser_navigate always succeeds (even navigating onto the affected page). Every
other tool (browser_take_screenshot, browser_close, browser_run_code_unsafe,
click, etc.) fails identically once that page is loaded, because whatever internal
readiness/snapshot check runs on each tool call resolves body via an implicit
strict-mode locator.
Ruled out during investigation
Stale install / version mismatch (npx cache, npm latest, Homebrew all pinned
to 0.0.78)
Specific MCP server implementation (reproduced identically on two independent
playwright-mcp-based servers)
Stale profile/process state (cleared all profiles, used a fresh --isolated
in-memory profile; bug persists)
Interaction mode (--caps vision uses coordinate-based tools instead of the
accessibility tree; bug persists)
Response snapshot generation (--snapshot-mode none disables the AI-facing
snapshot entirely; bug persists — confirming the body-locator check is part
of core tool/action handling, not the optional snapshot feature)
https://www.yahoo.com — all tools work normally (despite 190+ console errors
and many third-party ad iframes)
Affected page — every non-navigate tool call fails identically, every time
Suggested fix
Scope the internal body-resolution locator to .first() (matching the browser's
own document.body semantics) or catch the strict-mode violation and degrade
gracefully, rather than failing the entire tool call. A malformed page shouldn't
be able to make every tool call unusable.
I traced this to the strict body selector used by the Playwright core version pinned by @playwright/mcp@0.0.78. PR #41816, merged after that MCP release, changed the default AI snapshot root to a non-strict body,frameset query and appears to cover duplicate body elements as well.
Would you prefer this issue to be handled by rolling/publishing MCP with a newer core, or would a focused duplicate-body regression test still be useful? A broader alternative would be ensuring snapshot-mode none does not acquire an accessibility snapshot at all. I’d be happy to contribute if approved and assigned.
Activity
Punisheroot commentedon Jul 29, 2026
I traced this to the strict
bodyselector used by the Playwright core version pinned by @playwright/mcp@0.0.78. PR #41816, merged after that MCP release, changed the default AI snapshot root to a non-strictbody,framesetquery and appears to cover duplicate body elements as well.Would you prefer this issue to be handled by rolling/publishing MCP with a newer core, or would a focused duplicate-body regression test still be useful? A broader alternative would be ensuring
snapshot-mode nonedoes not acquire an accessibility snapshot at all. I’d be happy to contribute if approved and assigned.yury-s commentedon Aug 3, 2026
Closing as fixed by #41816, will be available in the next MCP release.