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
browser_console_messages reports 0-based line numbers #1839
<title>L</title><p>two</p><p>three</p><script>console.warn("on line 5");</script>
and ext.js, loaded from a page, with console.error("ext line 2") on its line 2.
Observed
[WARNING] on line 5 @ http://localhost:8765/lines.html:4
[ERROR] ext line 2 @ http://localhost:8765/ext.js:1
Expected
lines.html:5 and ext.js:2, the 1-based numbers that editors and DevTools show. Ideally the column too (:5:9).
Cause
ConsoleMessage.location().lineNumber is 0-based (per the Playwright API docs), and tab.ts:662 prints it as is. A model that follows these numbers into a source file looks one line too early.
Version:@playwright/mcp@0.0.84 (playwright-core 1.65.0-alpha-2026-10-30), Linux, Chrome. Source references are microsoft/playwright main @ 58d69dc, packages/playwright-core/src/tools/.
Hi, I'm the Playwright bot. I reproduced this and prepared a fix.
Reproduced on Linux in Chrome, Chromium, Firefox and WebKit, at upstream 1.66.0-next (dc668b5a44c1810a06c7114f405c9ecf975f15ec). The shared formatter prints Playwright's zero-based line unchanged. The fix converts it to one-based output for console responses and console log files, keeping the existing URL:line format.
Reproduction and checks
The existing browser_console_messages test now loads an HTML page with console.log("Hello, world!") on line 5 and an external /ext.js containing \nconsole.error("Error");, on line 2. Before the fix, all four headless browser projects return:
The regression asserts /:5 and /ext.js:2. No browser-specific difference was observed.
After the fix, npm run test-mcp -- console.spec.ts cli-devtools.spec.ts --project=chrome --project=chromium --project=firefox --project=webkit --reporter=line passed all 168 checks. npm run build and npm run flint also passed.
Activity
github-actions commentedon Nov 6, 2026
microsoft-playwright-automation commentedon Nov 6, 2026
Hi, I'm the Playwright bot. I reproduced this and prepared a fix.
Reproduced on Linux in Chrome, Chromium, Firefox and WebKit, at upstream
1.66.0-next(dc668b5a44c1810a06c7114f405c9ecf975f15ec). The shared formatter prints Playwright's zero-based line unchanged. The fix converts it to one-based output for console responses and console log files, keeping the existingURL:lineformat.Reproduction and checks
The existing
browser_console_messagestest now loads an HTML page withconsole.log("Hello, world!")on line 5 and an external/ext.jscontaining\nconsole.error("Error");, on line 2. Before the fix, all four headless browser projects return:The regression asserts
/:5and/ext.js:2. No browser-specific difference was observed.After the fix,
npm run test-mcp -- console.spec.ts cli-devtools.spec.ts --project=chrome --project=chromium --project=firefox --project=webkit --reporter=linepassed all 168 checks.npm run buildandnpm run flintalso passed.Draft PR: microsoft/playwright#43975
Triaged on Linux by the Playwright bot - agent run
chore: mark v0.0.85 (#1846)
chore: mark v0.1.24 (#529)