This document summarizes the implementation of multi-tab/window support in the MCP Selenium server.
-
Added five new tools to
src/lib/server.jsfor window management:get_window_handles: Retrieves all active window handles.get_current_window_handle: Gets the handle of the currently focused window.switch_to_window: Switches focus to a specific window by its handle.switch_to_latest_window: Switches to the most recently opened window.close_current_window: Closes the currently active window without ending the session.
-
Created
docs/MULTI_TAB_USAGE.md:- Provides detailed usage examples and best practices for the new window management tools.
-
Created
docs/CHANGELOG_TAB_SUPPORT.md:- Documents the new features and explains how they remain backward compatible.
-
Updated
README.md:- Added a new section documenting the multi-tab/window management tools.
To ensure the new tools function correctly, follow these testing steps:
- Start a browser session using the
start_browsertool. - Open a new tab/window by clicking a link that opens in a new tab (e.g.,
<a href="..." target="_blank">). - Use
get_window_handlesto verify that multiple handles are returned. - Use
switch_to_latest_windowto switch to the new tab. - Perform an action (e.g.,
get_element_text) to confirm the context has switched. - Use
close_current_windowto close the new tab. - Verify that the original tab is still active and responsive.