Repository navigation
Add Selenium Grid tools and saved Grids - #3
Open
AutomatedTester wants to merge 2 commits into
Open
AutomatedTester wants to merge 2 commits into
AutomatedTester wants to merge 2 commits into
Conversation
Agents that run browsers on a Selenium Grid had no way to see what the Grid was doing, and had to be told the Grid URL on every start. Add five selenium_grid_* tools to the default list: use, status, sessions, queue and bug_report. They only read the Grid, over /status, GraphQL and the session queue. Ending sessions, draining or removing nodes and clearing the queue are left to the person, and no tool guesses which node, session or request is meant. selenium_grid_use saves a Grid the person names to a config file (--config, SELENIUM_MCP_CONFIG, ./.selenium-mcp.json, then the user's config) as the default, so they are not asked again. Browsers then start on it. --grid now takes a saved Grid's name as well as a URL. No credentials are saved; a Grid is assumed to sit behind its own network or auth. Browsers started on a Grid are named selenium-mcp, so people can tell them apart in the Grid UI. CI runs the Grid tools against a real hub with two nodes.
Brings in the --caps tool groups. The Grid tools stay in the default list; the optional groups are listed after them in the README.
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.
Requested by David · project thread
🔗 Related Issues
Phase 1 of the Grid operations MCP plan.
💥 What does this PR do?
Agents that run browsers on a Selenium Grid couldn't see what the Grid was doing, and had to be given the Grid URL on every start. This PR fixes both.
Five
selenium_grid_*tools, in the default list:selenium_grid_useselenium_grid_statusnode, one node in detailselenium_grid_sessionsselenium_grid_queueselenium_grid_bug_report/status, GraphQL and the session queue. Ending sessions, draining or removing nodes and clearing the queue are left to the person. Tools never guess which node, session or request is meant, and the server instructions say so too.--config,SELENIUM_MCP_CONFIG,./.selenium-mcp.jsonand~/.config/selenium-mcp/config.json, and saves back to the same file. Browsers start on the saved default Grid.--gridnow takes a saved name as well as a URL, and still wins for that run.--gridstill works, but only for that run.se:name: selenium-mcp, so they show up named in the Grid UI.🔧 Implementation Notes
selenium_grid_status(nodeargument) rather than being a sixth tool. This keeps the default list at the 25-tool cap thattools_test.jsenforces. The tool list is about 2,820 of the 4,000-token budget.charset=utf-8;GridApisends that.--caps(open in another branch) is untouched. These tools are in the default list by design, since the server may run locally or remotely.💡 Additional Considerations
/statusand GraphQL. The queue hint compares browser names only, and says so.🔄 Types of changes
🧪 Testing
npm run lintpasses.test/unit/grid_test.jscovers config file lookup order, saving, validation and errors, the formatters, andGridApierrors. The formatter tests run against/status, GraphQL and queue answers recorded from a real 4.52 hub with two nodes, four sessions and two queued requests. All 70 unit tests outsidesnapshot_test.jspass locally.test/e2e/grid_test.jsstarts a real hub and two nodes fromSELENIUM_MCP_TEST_SERVER_JAR, and is skipped without it. It saves the Grid, reads status and node details, and starts the browser on the Grid. That browser start exercises BiDi through Grid. It also lists theselenium-mcpsession, the empty queue and the bug report. 5/5 pass locally against Grid 4.52.0.--selenium-manager trueon the nodes.snapshot_test.jsneed the nightlyselenium-webdriver, which needs a GitHub Packages token this environment doesn't have. Locally I usedselenium-webdriver@4.52.0from npm, so they fail here for that reason only; CI runs them with the nightly. I updated the e2e tool count from 20 to 25.🤖 AI assistance
Generated by Claude Code