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
feat: add switch_browser tool with noLaunch CLI option
Adds the ability to dynamically switch between browser instances at runtime,
with support for both HTTP and WebSocket connection URLs and configurable
connection timeouts.
New Features:
- switch_browser tool for connecting to different browser instances
- --noLaunch CLI flag to start without auto-launching a browser
- Timeout parameter with 10-second default for connection attempts
- Automatic HTTP to WebSocket URL conversion
- Support for ws://, wss://, http://, and https:// protocols
Implementation:
- Created src/context.ts to manage browser context lifecycle
- Created src/config.ts to break dependency cycles
- Added getBrowser/setBrowser helpers for better testability
- Added disconnectBrowser() to safely close browser connections
- Proper timeout cleanup to prevent resource leaks
- Comprehensive error handling with proper Error type checks
Testing:
- 6 new integration tests with actual browser instances
- Tests verify browser disconnection, connection switching, and error handling
- All tests use headless mode for CI compatibility
- Proper test isolation with independent browser instances per test
Documentation:
- Updated README.md with new tool and CLI option
- Auto-generated tool reference documentation
- Updated release-please configuration
**Description:** Connect to a different browser instance. Disconnects from the current browser (if any) and establishes a new connection. Accepts either HTTP URLs (e.g., http://127.0.0.1:9222) or WebSocket endpoints (e.g., ws://127.0.0.1:9222/devtools/browser/<id>).
183
+
184
+
**Parameters:**
185
+
186
+
-**url** (string) **(required)**: Browser connection URL. Can be an HTTP URL (e.g., http://127.0.0.1:9222) which will be auto-converted to WebSocket, or a direct WebSocket endpoint (e.g., ws://127.0.0.1:52862/devtools/browser/<id>).
187
+
188
+
---
189
+
179
190
### `wait_for`
180
191
181
192
**Description:** Wait for the specified text to appear on the selected page.
0 commit comments