-
-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Browser automation works correctly on macOS with Chromium and Chrome browsers, but the browser processes fail to terminate properly when attempting to close the browser window, requiring manual cleanup through Activity Monitor. This issue is specific to macOS and does not affect other Chromium-based browsers.
Environment
- OS: macOS (all versions)
- Browsers: chromium, chrome
Problem Details
When running browser automation with the MCP Browser Agent on macOS using either Chromium or Chrome:
- All automation features work as expected
- Browser operations complete successfully
- When attempting to close the browser window (e.g., right-clicking on the dock icon and selecting "Quit"), the browser window closes but the process remains active
- The browser process continues running in the background
- Manual termination is required via Activity Monitor or terminal commands (
kill
command)
Specific Behavior
- Right-clicking the browser icon in the dock and selecting "Quit" closes the window but leaves the process running
- Using Cmd+Q to quit the browser has the same effect - window closes, process remains
- The only way to properly terminate the process is through Activity Monitor or terminal commands
Root Cause
This appears to be related to known issues in the Playwright repository regarding browser process cleanup on macOS. The issue has been tracked in multiple Playwright issues.
Workaround
Currently, users need to manually terminate the browser process after attempting to close the browser:
- Open Activity Monitor
- Search for the Chromium/Chrome process
- Force quit the process
- Or use terminal:
ps aux | grep -i chrome
andkill -9 [PID]
Proposed Solutions
While we await upstream fixes in Playwright, we're exploring several potential solutions:
- Force process termination: Implement a cleanup mechanism that forcefully kills the browser process on macOS after window closure
- Process monitoring: Add a background process monitor that detects window closure and cleans up orphaned browser processes
- Alternative browser contexts: Investigate using different browser context configurations that may handle cleanup better
- Signal handling: Implement custom signal handlers for macOS to ensure proper process termination on window close events
Status
This issue remains open as we evaluate different approaches to handle this platform-specific behavior. While the core functionality is not affected, we recognize the importance of proper process cleanup for production environments.
Contributing
If you have experience with this issue or have found alternative solutions, please share your findings. We welcome pull requests that address this problem while maintaining compatibility across all supported platforms.
Important
This issue is being tracked pending resolution in the upstream Playwright project, but we're actively working on MCP-specific workarounds.