SuperAPI AI Directory

selenium-mcp

Selenium WebDriver automation with assertions and self-healing locators, plus code generation for Java, Python and C# test frameworks and CI pipelines.

Open website

About this tool

selenium-mcp (package name seleniumboot-mcp) is a Python-based Model Context Protocol (MCP) server that brings Selenium WebDriver automation to Claude and other AI assistants. It lets AI assistants control a real browser: navigate pages, interact with elements, run assertions, and generate ready-to-run Java TestNG / JUnit 5 / Cucumber / pytest test code based on recorded sessions.

Key capabilities

  • Provides 43 tools by default, and exposes all 77 tools after setting the environment variable SELENIUM_MCP_TOOLS=all.
  • Supports generating Java TestNG / JUnit 5 and Python pytest test code.
  • Screenshots are returned as ImageContent and can be rendered inline in Claude.
  • Full session recording, covering actions such as hover, double_click, right_click, scroll, and select_option.
  • Provides code generation with Java and Python templates for hover, drag-and-drop, selection, and scrolling.
  • Automatically starts the browser on first use, with no need to explicitly call start_browser.
  • Supports Page Object Model generation (generate, language=java, kind=page_object).
  • Supports Cucumber / Gherkin step generation (generate, language=gherkin).
  • Self-healing locators: automatically tries fallback strategies when a selector fails.
  • Alert/dialog handling, iframe switching, shadow DOM, and table extraction.
  • Cookie, localStorage, and sessionStorage management.
  • Mobile device emulation via Chrome DevTools Protocol.
  • Sends special keys (Tab, Enter, function keys, Ctrl+A, etc.).
  • Uploads files via <input type="file">.
  • Captures browser console logs.
  • Multi-tab management (open, close, list).
  • Page scrolling (top, bottom, by pixels).
  • C# NUnit + Selenium code generation.
  • GitHub Actions CI workflow generator (Maven / Gradle / pytest).
  • Playwright TypeScript migration hints.
  • CI/CD configuration for Jenkins / GitLab CI.

Usage Runtime requirements are Python 3.10+ and Chrome; ChromeDriver does not need to be installed separately, Selenium Manager handles it automatically.

VS Code (simplest) — install the Selenium Boot MCP extension from the VS Code Marketplace. The extension automatically: registers the MCP server with GitHub Copilot (no configuration file needed); creates .mcp.json in the project so Claude Code detects it the next time it opens; and prompts to run pip install seleniumboot-mcp if the Python package is missing. When Claude Code asks "Allow MCP server seleniumboot?", click Allow.

JetBrains IDEs — search for "Selenium Boot MCP" in Settings → Plugins → Marketplace to install (or install from the plugin page). The plugin registers the MCP server with the JetBrains AI Assistant and prompts pip install seleniumboot-mcp if the Python package is missing. You can install/upgrade, register, or check status via Tools → Selenium Boot MCP.

VS Code (manual) — add .vscode/mcp.json in the project root for GitHub Copilot; add .mcp.json in the project root for Claude Code. After opening the project in VS Code, Claude Code will prompt to approve the server.

Claude Desktop — edit the configuration: on Windows, it is %APPDATA%\claude-desktop\config.json, on macOS it is ~/.config/claude-desktop/config.json, then restart Claude Desktop.

Once the server is running, you can communicate with Claude directly in natural language, without needing to call start_browser; Chrome will start automatically on first use. Claude controls a real browser, records every action, and on request generates complete test code that can be pasted directly into a Maven or Gradle project.

Self-healing locators When a selector cannot find an element, seleniumboot-mcp automatically tries alternative strategies before giving up. Successful fallbacks are cached, and the repaired selector is then reused automatically. You can use get_healed_locators to inspect the cache and update the test code, and clear_healed_locators to start over.

Selenium Boot project support If the project you are in contains Selenium Boot (auto-detected via selenium-boot.yml or the io.github.seleniumboot dependency, no switch needed), the same tools instead generate framework-native code: classes extend BaseTest / BaseJUnit5Test / BaseCucumberSteps, with no need to write driver lifecycle boilerplate; locators follow an accessibility-first hierarchy (getByRole / getByLabel / getByTestId); assertions are web-first (assertThat(locator).isVisible()/.hasText()) rather than raw TestNG/JUnit calls. If a Selenium Boot project is not detected, the generated Java code includes a brief comment explaining that option and providing a link, with everything else unchanged; Python/C# output is unaffected.

Migrating an existing Selenium project The migrate tool runs selenium-boot-migrator's read-only analyze on the project and returns its JSON report (what maps cleanly, what needs manual handling). It requires Java 17+. On first use it downloads a pinned version of the migrator (v0.1.1) from GitHub to ~/.cache/seleniumboot-mcp/, verifies the SHA-256, and reuses it; this is the tool's only network call. You can skip the download by setting SELENIUM_BOOT_MIGRATOR_JAR to point to your own built jar, or by putting the selenium-boot-migrator launcher on PATH. It does not modify your project.

Limitations and notes

  • Requires Python 3.10+ and Chrome.
  • Tool definitions are sent to the model every session; since 0.8.0 the default exposes the core configuration (43 tools, about 3.9k tokens), covering the recording and generation workflow (browser, elements, assertions, a single generate tool for all output targets, and migrate). Cookies, storage, windows/tabs, network emulation, device emulation, screenshot diffing, accessibility, self-healing, shadow DOM, tables, and double-click/right-click/drag are not in the default scope. Setting SELENIUM_MCP_TOOLS=all exposes all 77 (about 6.4k tokens).
  • The migrate tool requires Java 17+ and performs read-only analysis only; it does not edit the project.

Related links GitHub: github.com/seleniumboot/selenium-mcp PyPI: pypi.org/project/seleniumboot-mcp VS Code Marketplace: marketplace.visualstudio.com