feat: add switch_browser tool with noLaunch CLI option#582
Open
elijahr wants to merge 3 commits intoChromeDevTools:mainfrom
Open
feat: add switch_browser tool with noLaunch CLI option#582elijahr wants to merge 3 commits intoChromeDevTools:mainfrom
elijahr wants to merge 3 commits intoChromeDevTools:mainfrom
Conversation
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
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Resolved conflicts between two independent refactorings: - Our branch: extracted VERSION/args to config.js, added switch_browser tool - Upstream: added features.js for feature flags, bumped VERSION to 0.10.2 Changes: - Updated VERSION to 0.10.2 in config.ts - Added features.js import and conditional issue loading - Retained all switch_browser tool functionality - No duplicate code, clean integration All 203 tests pass.
The convertHttpToBrowserUrl() function previously had no timeout on the fetch() call, which could cause switch_browser to hang indefinitely when the target browser was unreachable or unresponsive. Changes: - Added AbortController with configurable timeout (default 10s) - Enhanced error messages to distinguish timeout from connection failures - Added test coverage for HTTP fetch timeout behavior - Updated documentation to reflect new timeout parameter Fixes potential infinite hang when using HTTP URLs with unreachable browsers.
Collaborator
|
Could you please file a feature request instead and provide details about your use case? cc @natorion |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Implementation:
Testing:
Documentation: