mcp-playwright
mcp-playwright copied to clipboard
Bug: playwright_console_logs tool doesn't capture JavaScript errors/exceptions
Title
Bug: playwright_console_logs tool doesn't capture JavaScript errors/exceptions
Description
Summary
The playwright_console_logs tool currently captures standard console logs but fails to retrieve JavaScript errors and exceptions that are visible in the browser's developer console.
Steps to Reproduce
- Run a web page that contains console logs and JavaScript errors
- Call
playwright_console_logswithtype: allparameter - Compare results with actual browser console output
Expected Behavior
The playwright_console_logs tool should return all console output including errors, warnings, and exceptions.
Actual Behavior
Only standard console logs (from console.log()) are returned. JavaScript errors and exceptions are completely omitted from the results.
Example
When calling:
playwright_console_logs({ type: "all" })
Results returned:
Retrieved 3 console log(s):
[log] Audio system initialized successfully
[log] DEBUG: Controls manager initialized
[log] DEBUG: Snake initialized
Actual browser console output:
Audio system initialized successfully
DEBUG: Controls manager initialized
DEBUG: Snake initialized
Uncaught TypeError: this.snake.getBody is not a function
at Game.getOccupiedPositions (game.js:1209:42)
at Game.initializeGameState (game.js:429:41)
at Game.startGameWithCountdown (game.js:364:14)
at HTMLButtonElement.<anonymous> (game.js:277:18)
Environment
- Playwright version: 1.0.1
- OS: Win 11
- Node.js version: 22.14
Additional Context
This issue impacts debugging capabilities since errors are not visible through the tool interface. It makes it difficult for LLM to diagnose problems
This is currently the limitation of tool to accept beyond DEBUB, ERROR, LOG, ALL, but not the uncaught TypeError, seems like ALL is not falling under this category, which is crazy.
I will check that out.
Thanks for reporting.
Thanks, Karthik KK
This is currently the limitation of tool to accept beyond DEBUB, ERROR, LOG, ALL, but not the uncaught TypeError, seems like ALL is not falling under this category, which is crazy.
I will check that out.
Thanks for reporting.
Thanks, Karthik KK
Hi, I’ve submitted a pull request to fix this issue: https://github.com/executeautomation/mcp-playwright/pull/115 It enhances error capturing by including pageerror(such as uncaught exceptions) and unhandledrejection events(such as unhandled Promise rejections), along with test cases. Could you please take a look when you get a chance? Thanks!
FYI https://github.com/executeautomation/mcp-playwright/pull/115 has been merged