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
[Bug]: [MCP] browser_navigate_back and browser_navigate_forward hang on modal dialogs instead of racing against modal states #43251
In Playwright MCP server and CLI, when navigating backwards (browser_navigate_back / playwright-cli go-back) or forwards (browser_navigate_forward / playwright-cli go-forward), if the target page or current page triggers a modal dialog (such as a beforeunload dialog or prompt) during navigation commit, the tool call hangs for 30 seconds and fails with:
TimeoutError: page.goBack: Timeout 30000ms exceeded.
Call log:
- waiting for navigation until "commit"
Because the action hangs until timeout, the modal state is never surfaced in the tool response (### Modal state: - ["beforeunload" dialog with message ""]: can be handled by browser_handle_dialog), and the agent is never given the opportunity to accept or dismiss the dialog via browser_handle_dialog or playwright-cli dialog-accept.
Reproduction Screenshots
1. Repro — browser_navigate_back stalls & times out on modal state:
2. Fixed Behavior — Races against modal states and returns immediate dialog state:
Why does this happen?
In packages/playwright-core/src/tools/backend/tab.ts, navigation methods like navigate() and reload() wrap page operations in this._raceAgainstModalStates(...):
However, in packages/playwright-core/src/tools/backend/navigate.ts, goBack and goForward bypassed Tab and directly invoked tab.page.goBack(...) / tab.page.goForward(...) without racing against modal states:
When a dialog opens during navigation commit, page.goBack() hangs waiting for commit, preventing the tool from ever returning the active modal state to the agent.
Expected behavior
goBack and goForward should race against modal states (matching navigate and reload). When a modal dialog opens, the tool call should return immediately with the modal state description so the agent can inspect and resolve it via browser_handle_dialog or playwright-cli dialog-accept.
Activity
chore: mark v0.1.23 (#494)