Selenium MCP Server
Supports automated browser sessions in Firefox alongside Chrome and Edge through Selenium Grid.
Sets up Python pytest Selenium projects, records flows, and generates pytest test files for Selenium-based tests.
Sets up Robot Framework with SeleniumLibrary and generates Robot Framework test cases from recorded browser flows.
Connects to Selenium Grid to run parallel browser automation sessions, enabling scalable and isolated multi-browser exploration and testing.
Initializes WebdriverIO projects, records browser interactions, and generates WebdriverIO/TypeScript test files.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Selenium AI Agent
AI test agents for Selenium: plan, review, generate and heal tests from a prompt, with reports linked to the test plan you approved.
Selenium AI Agent is an open-source MCP server that brings Playwright-style AI test agents (planner, generator, healer) to Selenium: you approve the test plan before any test is written, tests are generated and self-healed in a real browser (also in parallel on Selenium Grid), and every JUnit or Allure result links back to its plan scenario. It works in Claude Code, Claude Desktop, VS Code (GitHub Copilot), Cursor, JetBrains IDEs and other MCP clients. On npm: selenium-ai-agent.
Test agents: a planner explores your app and writes a structured test plan, a generator turns it into tests checked live in the browser, and a healer runs and repairs them.
You approve the plan first: the plan opens as a review page in your browser; tests are only generated from a plan you approved.
Reports testers can read: JUnit XML and Allure, with every result linked to its plan scenario: which scenario failed, at which step, with a screenshot.
Python + pytest by default, and any other language on request: Java, C#, JavaScript/TypeScript, WebdriverIO, Robot Framework.
Works in your AI client: Claude Code, Claude Desktop, VS Code (GitHub Copilot) and Cursor.
Built in Node.js: run it with
npx -y selenium-ai-agent; the matching browser driver is downloaded for you.Scales with Selenium Grid: parallel sessions on Chrome, Firefox and Edge.
Contents
Related MCP server: MCP Selenium Grid
Video Tutorials
Short demos with a voice-over, on YouTube:
Planner: from one prompt to a test plan | Generator: from the plan to running pytest tests |
|
|
The planner explores a web shop and writes | The generator writes one pytest file per plan test, runs them, and shows the HTML report, including a real bug it found. (1:44) |
More tutorials: youtube.com/@ralphvanderhorst5193 · Practice site used in the demos: practiceautomatedtesting.com
Quick Start
You need Node.js 20+ and a browser (Chrome, Firefox or Edge).
1. Add the server to your AI client
Claude Code:
claude mcp add selenium-ai-agent -- npx -y selenium-ai-agentClaude Desktop, Cursor, Windsurf or Junie in IntelliJ IDEA / PyCharm (writes the config for you):
npx selenium-ai-agent install claude-desktop # or: cursor, windsurf, junieWhere your test plans, tests and reports go:
Claude Code, VS Code, Cursor with the agents installed in your project (
init-agents, step 2): in the project itself, with plans in itsspecs/.Claude Desktop and other clients with one global config: in
~/selenium-ai-agent, since they aren't tied to a project. Add--output-dir=<folder>to use another folder.
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json) and Cursor (.cursor/mcp.json):
{
"mcpServers": {
"selenium-ai-agent": {
"command": "npx",
"args": ["-y", "selenium-ai-agent"]
}
}
}VS Code / GitHub Copilot (.vscode/mcp.json):
{
"servers": {
"selenium-ai-agent": {
"command": "npx",
"args": ["-y", "selenium-ai-agent"],
"type": "stdio"
}
}
}IntelliJ IDEA / PyCharm with AI Assistant: Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add → As JSON, and paste the mcpServers JSON above. With GitHub Copilot in a JetBrains IDE: Settings → Tools → GitHub Copilot → Model Context Protocol (MCP) → Configure, and add the servers JSON above.
See MCP Client Setup and the package README for all clients, including Cline and Windsurf.
2. Install the test agents in your project (optional)
npx selenium-ai-agent init-agents --loop=claude # Claude Code subagents
npx selenium-ai-agent init-agents --loop=vscode # VS Code chat modes
npx selenium-ai-agent init-agents --loop=copilot # GitHub Copilot coding agent
npx selenium-ai-agent init-agents --loop=cursor # Cursor rulesAdd --with-rules to also put Selenium's rules for AI agents in your project's CLAUDE.md, .cursor/rules/selenium.mdc or .github/copilot-instructions.md, so every AI tool you use writes modern Selenium code.
3. Ask for tests
Explore the shopping section of https://practiceautomatedtesting.com and create a test plan
for the shopping cart and checkout.Then:
Generate Selenium tests from specs/shopping-cart-and-checkout.md, run them, and show me the test report.Something not starting? Run npx selenium-ai-agent doctor.
How the Test Agents Work
┌─────────────────┐ ┌─────────────┐ ┌─────────────┐ ┌────────────┐
│ Analyzer │───▶│ Planner │───▶│ Generator │───▶│ Healer │
│ (risk profile) │ │ (test plan) │ │ (test code) │ │(fix tests) │
└─────────────────┘ └─────────────┘ └─────────────┘ └────────────┘
│ │
human review human reviewAgent | What it does | Output |
Analyzer (optional) | Scans the product and builds a risk profile, so testing starts where it matters most. | Risk profile |
Planner | Explores the app in a real browser, takes an inventory of every page and pop-up, and writes a plan in the same structure as Playwright's planner: suites → tests → steps with |
|
Generator | Writes one test file per plan test, with an assertion for every | Test files, a run command |
Healer | Runs the tests, debugs failures, inspects the page and fixes broken locators or waits, then runs them again. | Passing tests, or a clear bug report |
Migrator | Upgrades an existing suite to current Selenium 4: scans it for Selenium 3 patterns, sleeps and mixed waits ( | Migrated tests, before/after results per file |
The generator and healer follow Selenium's guide for AI agents (and WebdriverIO's for WebdriverIO): they read the current docs from llms.txt with get_selenium_docs, and refuse to write a test with a sleep, a driver path, DesiredCapabilities or a Selenium 3 API.
You review the plan before code is generated, and the code before it is committed. The plan review is on by default: every plan is saved as a draft, and the generator refuses a draft plan. The planner opens it as a review page in your browser: every test with its steps and expected results, a comment box per test, and Approve plan / Request changes buttons that write your decision into the plan. Requested changes go back to the planner. You can also review without the AI: npx selenium-ai-agent review in your project opens all plans in your browser. An overview of all plans shows each plan's review status, its tests, the test files generated from it and the last run. Need speed instead? SELENIUM_MCP_PLAN_REVIEW=off (or --no-plan-review) turns the check off. The Agent Workflow guide covers each stage in detail.
Test reports, linked to the approved plan
Selenium has no reporting of its own, so every generated suite writes one: JUnit XML by default (read by every CI system, ReportPortal and Allure), and Allure when you ask for it or your project already uses it. healer_run_tests reads the results and links every test to the plan scenario it implements:
reports/junit-plans.xml: the JUnit results with the plan, scenario and review status as properties of each test, for your CI or ReportPortalAllure results get the plan as epic, the suite as feature and the scenario as story, so the report shows your approved plan with a result per scenario. Each test is named after its scenario, its description is the steps and expected results you approved, every plan step is a step in the report (in the plan's words), and a failing test gets a screenshot
the plan's review page shows the latest result per scenario (✓ passed, ✗ failed with the message, not run yet), and the overview of all plans shows "2 of 3 scenarios passed"
tests with no approved plan behind them are counted, so they stand out
Example Prompts
Goal | Prompt |
Try it |
|
Test plan |
|
Python tests (default) |
|
Another language |
|
Fix failures |
|
Allure report |
|
Parallel (Grid) |
|
Example Chats shows each prompt with the tools it calls and the result, including generated code for pytest, WebdriverIO, Playwright and Robot Framework.
Languages and Frameworks
If you don't name one, the generator uses your project's own stack: Java with JUnit 5 or TestNG (from pom.xml or build.gradle), Python with pytest or unittest (requirements.txt, pyproject.toml, pytest.ini), C# with NUnit, xUnit or MSTest (*.csproj), JavaScript/TypeScript (package.json) or Robot Framework (*.robot). In an empty project it uses Python with pytest.
Language | Frameworks ( |
Python | pytest ( |
Java | Maven ( |
C# | NUnit ( |
JavaScript / TypeScript | WebdriverIO ( |
Conventions per framework are in Framework Standards.
Sample projects
Ready-made projects to try the agents on, each with a test plan, a section left for the generator to write, and an old Selenium 3 suite for the migrator:
Sample | Stack |
Java 17+, Maven, Selenium 4, JUnit 5, page objects | |
.NET 8+, Selenium 4, NUnit, page objects |
Parallel Testing with Selenium Grid
Everything above works with a local browser. Selenium Grid adds parallel sessions: explore or test many parts of an application at once, across Chrome, Firefox and Edge.
Playwright MCP | Selenium AI Agent | |
Parallelism | Single browser, shared context | Many sessions on Grid nodes |
Scaling | Limited by one browser | Add nodes as needed |
Isolation | Shared state between clients | Full isolation per session |
Multi-browser | One at a time | Chrome, Firefox and Edge at the same time |
1. Start the Grid
git clone https://github.com/learn-automated-testing/selenium-ai-agent.git
cd selenium-ai-agent/selenium-grid
docker-compose up -d # Grid console: http://localhost:4444
docker-compose up -d --scale chrome-node=10 # scale up any timeThe included docker-compose.yml starts a hub, 4 Chrome nodes and 1 Firefox node.
2. Point the server at it
{
"mcpServers": {
"selenium-ai-agent": {
"command": "npx",
"args": ["-y", "selenium-ai-agent"],
"env": { "SELENIUM_GRID_URL": "http://localhost:4444" }
}
}
}3. Explore in parallel
Explore https://practiceautomatedtesting.com in parallel: the homepage, products, cart and checkout at the same time.parallel_explore starts one session per section, exploration_merge combines the results into one site map, and planner_generate_plan writes the test plan.
Configuration
Variable | Default | Description |
| — | Grid hub URL; enables the parallel tools |
|
| Run the browser headless |
|
| Tool groups to load, e.g. |
|
|
|
|
| Folder for the test plans, e.g. |
|
| Mask basic automation flags (does not get past advanced bot protection) |
| — |
|
All variables, CLI flags, driver and proxy setup, and troubleshooting are in the package README.
Tools
79 tools, 65 without Grid.
Test agents
Agent | Tools |
Planner |
|
Generator |
|
Healer |
|
Analyzer |
|
Browser
Group | Tools |
Navigation |
|
Page analysis |
|
Elements |
|
Input |
|
Mouse |
|
Verification |
|
Browser |
|
Tabs |
|
Session |
|
Recording |
|
Batch |
|
Docs |
|
Grid and parallel execution
Tool | Description |
| Check Grid health, nodes and capacity |
| Start or stop the Docker Compose Grid |
| Scale Grid nodes up or down |
| Create, switch and list browser sessions on the Grid |
| Clean up one or all sessions |
| Explore several URLs at the same time |
| Run tasks in parallel across sessions |
| Combine or compare exploration results |
| Generate a test plan from an exploration |
Documentation
Video tutorials: planner and generator demos on YouTube
MCP Client Setup: Claude Code, Claude Desktop, Cursor, Copilot, Cline, Windsurf
Example Chats: prompts with the tools they call and the results
Agent Workflow: the end-to-end testing pipeline
Framework Standards: code generation conventions
Package README: all tools, options and troubleshooting
selenium-ai-agent/
├── selenium-mcp-server/ # TypeScript MCP server (npm: selenium-ai-agent)
│ └── src/
│ ├── server.ts # MCP protocol handler
│ ├── context.ts # Browser session management
│ ├── grid/ # Selenium Grid integration
│ └── tools/ # navigation, elements, grid, agents, analyzer
├── selenium-grid/
│ └── docker-compose.yml # Selenium Grid setup
├── agents/ # Agent prompt definitions
└── docs/ # Guides and diagramsContributing
Contributions are welcome:
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push the branch (
git push origin feature/amazing-feature)Open a pull request
License
MIT — see LICENSE.
Acknowledgments
Selenium: the browser automation framework
Model Context Protocol: the AI agent communication standard
Anthropic: for Claude and the MCP specification
Playwright: whose test agents inspired the planner, generator and healer
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Give AI agents a real cloud Chrome: open sessions, navigate, read pages, click, type and screenshot.
Browser agents and stealth cloud browsers for AI: run web tasks, fill forms, extract data.
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Related MCP Servers
- AlicenseCqualityBmaintenanceEnables AI assistants to automate web browser interactions through Selenium WebDriver. Supports multi-browser automation, element interaction, navigation, and web testing capabilities.561,210 npm6MIT
- AlicenseNot gradedqualityDmaintenanceEnables browser automation by managing Selenium Grid browser instances (Chrome, Firefox, Edge) in Docker or Kubernetes environments. Provides secure, scalable browser control for AI agents and testing workflows.8MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to automate browser interactions using Selenium WebDriver, supporting multiple browsers and tools for navigation, clicking, typing, screenshots, and more.MIT
- AlicenseBqualityDmaintenanceEnables AI agents to fully control Google Chrome: navigate, click, fill forms, inspect DevTools, and manage tabs with parallel execution and session isolation.245 npmMIT

