20 Commits

Author SHA1 Message Date
a65f00667a fix: add 10-second timeout to accessibility snapshots
Prevents infinite hangs when _snapshotForAI() blocks on complex pages,
SVG files, or file:// URLs. Returns a helpful message suggesting
browser_take_screenshot as an alternative.
2026-02-03 00:23:15 -07:00
96641283c3 feat: add WebRTC connection monitoring tools
Add real-time WebRTC connection monitoring for testing video calling apps.
Monitors real RTCPeerConnection instances and collects connection statistics.

New tools:
- browser_start_webrtc_monitoring: Enable monitoring and stats collection
- browser_get_webrtc_connections: List connections with state filtering
- browser_get_webrtc_stats: Detailed stats (bitrate, packet loss, jitter, RTT)
- browser_stop_webrtc_monitoring: Stop stats polling, preserve data
- browser_clear_webrtc_data: Clear captured connection data

Implementation:
- Intercepts RTCPeerConnection constructor via page.addInitScript()
- Captures state changes via page.exposeFunction() callbacks
- Collects stats via page.evaluate() calling getStats()
- Tab-level storage with Context aggregation (same pattern as notifications)
- Configurable stats polling interval (default 1s)

Use cases:
- Test WebRTC call quality in real-time
- Monitor connection states and failures
- Analyze bandwidth, packet loss, frame rates
2026-01-16 20:39:44 -07:00
1c23c5f2f7 feat: add Web Push Notification support with pull-based retrieval
Adds comprehensive Web Notification API support:
- Intercepts Notification constructor via page.addInitScript()
- Bridges notification data to Node.js via page.exposeFunction()
- Stores notifications in Tab and Context for pull-based retrieval

New MCP tools:
- browser_configure_notifications: grant/deny permissions per origin
- browser_list_notifications: query captured notifications
- browser_handle_notification: click or close notifications
- browser_wait_notification: wait for matching notification
- browser_clear_notifications: clear notification history

Architecture uses modal state pattern for notification handling,
consistent with existing dialog and file chooser patterns.
2026-01-12 19:31:26 -07:00
9257404ba3 feat: fix video recording session persistence and add HTTP request monitoring
Video Recording Fixes:
- Fix session persistence issues where recording state was lost between tool calls
- Improve page video object handling by triggering navigation when needed
- Add browser_reveal_artifact_paths tool to show exact file locations
- Enhance browser_recording_status with detailed debugging info and file listings
- Add clearVideoRecordingState() method for proper state management
- Keep recording config available for debugging until new session starts

Request Monitoring System:
- Add comprehensive RequestInterceptor class for HTTP traffic capture
- Implement 5 new MCP tools for request monitoring and analysis
- Support multiple export formats: JSON, HAR, CSV, and summary reports
- Add filtering by domain, method, status codes, and response timing
- Integrate with artifact storage for organized session-based file management
- Enhance browser_network_requests with rich intercepted data

Additional Improvements:
- Add getBaseDirectory/getSessionDirectory methods to ArtifactManager
- Fix floating promise in tab.ts extension console message polling
- Add debug script for comprehensive video recording workflow testing
- Update README with new tool documentation

Resolves video recording workflow issues and adds powerful HTTP traffic
analysis capabilities for web application debugging and security testing.
2025-09-05 07:17:11 -06:00
afaa8a7014 feat: comprehensive console capture and offline mode support
Major enhancements to browser automation and debugging capabilities:

**Console Capture Features:**
- Add console output file option (CLI, env var, session config)
- Enhanced CDP console capture for service worker messages
- Browser-level security warnings and mixed content errors
- Network failure and loading error capture
- All console contexts written to structured log files
- Chrome extension for comprehensive console message interception

**Offline Mode Support:**
- Add browser_set_offline tool for DevTools-equivalent offline mode
- Integrate offline mode into browser_configure tool
- Support for testing network failure scenarios and service worker behavior

**Extension Management:**
- Improved extension installation messaging about session persistence
- Console capture extension with debugger API access
- Clear communication about extension lifecycle to MCP clients

**Technical Implementation:**
- CDP session management across multiple domains (Runtime, Network, Security, Log)
- Service worker context console message interception
- Browser context factory integration for offline mode
- Pure Chromium configuration for optimal extension support

All features provide MCP clients with powerful debugging capabilities
equivalent to Chrome DevTools console and offline functionality.
2025-08-31 16:28:43 -06:00
7de63b5bab feat: add console output file option for debugging and monitoring
Add comprehensive console logging to file functionality:
- CLI option --console-output-file to specify output file path
- Environment variable PLAYWRIGHT_MCP_CONSOLE_OUTPUT_FILE support
- Session configuration via browser_configure_snapshots tool
- Real-time structured logging with timestamp, session ID, and URL
- Automatic directory creation and graceful error handling
- Captures all console message types (log, error, warn, page errors)

Useful for debugging browser interactions and monitoring console activity
during automated sessions.
2025-08-24 14:12:00 -06:00
Pavel Feldman
6320b08173
chore: follow up on tab snapshot capture (#739) 2025-07-22 17:43:42 -07:00
Pavel Feldman
601a74305c
chore: introduce response type (#738) 2025-07-22 16:36:21 -07:00
Pavel Feldman
468c84eb8f
chore: move state to tab, do not cache snapshot (#730) 2025-07-22 07:53:33 -07:00
Pavel Feldman
5bfff0a059
chore: include recent console logs in results (#689) 2025-07-17 14:58:44 -07:00
Pavel Feldman
c97bc6e2ae
chore: allow right click (#687)
Fixes https://github.com/microsoft/playwright-mcp/issues/467
2025-07-17 13:24:05 -07:00
Pavel Feldman
a5a57df105
chore: include page errors in console messages (#671)
Fixes https://github.com/microsoft/playwright-mcp/issues/669
2025-07-15 15:46:09 -07:00
Dmitry Gozman
0df6d7a441
chore: roll playwright to Jun 10th, v1.53 (#542)
Co-authored-by: Simon Knott <simonknott@microsoft.com>
2025-06-11 15:53:14 +01:00
Pavel Feldman
aa6ac51f92
feat(trace): allow saving trajectory as trace (#426) 2025-05-14 18:08:44 -07:00
Pavel Feldman
57b3c14276
chore: only reset network log upon explicit navigation (#377)
Fixes https://github.com/microsoft/playwright-mcp/issues/376
2025-05-08 17:02:09 -07:00
Max Schmitt
a115c31953
chore: rename console to consoleMessages (#372)
Motivation: `console` is a global object in Node.js and having a method
like that confuses intellisense.
2025-05-07 16:40:08 +02:00
Simon Knott
c2255246a3
fix: don't error on navigating to a download link (#328) 2025-05-07 12:47:45 +02:00
Simon Knott
a15f0f301b
chore: save downloads to outputDir (#310) 2025-05-02 10:57:31 +02:00
Max Schmitt
685dea9e19
chore: migrate to ESM (#303)
- [Why do I need `.js`
extension?](https://stackoverflow.com/a/77150985/6512681)
- [Why setting `rootDir` in the
`tsconfig.json`?](https://stackoverflow.com/a/58941798/6512681)
- [How to ensure that we add the `.js` extension via
ESLint](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/extensions.md#importextensions)

Fixes https://github.com/microsoft/playwright-mcp/issues/302
2025-04-30 23:06:56 +02:00
Pavel Feldman
6e76d5e550
chore: split context.ts into files (#284) 2025-04-28 16:14:16 -07:00