Skip to main content

Install and Check the Agent

Why This Matters

Most problems with browser agents are not AI problems. Chrome and its driver disagree on a version, a company proxy blocks the driver download, or the server writes its plans into a folder you never look at. Ten minutes of setup, and one diagnostic command, save you an afternoon of “the agent does nothing”.

What you will learn

  • What Selenium AI Agent needs, and how to start it without installing anything
  • How to connect it to Claude Code, VS Code, Cursor or a JetBrains IDE
  • How to install the test agents and Selenium’s rules into a project
  • How to check the setup with doctor

Requirements

  • Selenium AI Agent 3.9.1 or newer. npx selenium-ai-agent always runs the latest version; the course relies on fixes in 3.9.1 (the heal policy, the CI gate in a fresh checkout, the driver check).
  • Node.js 20 or newer. The server is a Node.js program; your tests can be in any language.
  • Chrome for local runs. Firefox and Edge are available through Selenium Grid (lesson 20).
  • An AI assistant that supports MCP: Claude Code, Claude Desktop, GitHub Copilot in VS Code, Cursor, JetBrains AI Assistant or Junie, Windsurf, Cline.
  • For the exercises: Python 3.10+ with pytest and selenium. Java and WebdriverIO setups follow in lesson 11.

You don’t install a ChromeDriver yourself. The server finds the Chrome you have, and downloads and caches the matching driver.

Start a practice project

Make an empty folder for the course and make it a project, so the agent knows where to write:

mkdir selenium-agent-practice && cd selenium-agent-practice
git init
python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install selenium pytest

The server writes test plans, tests and reports into the project it runs in: the nearest folder with .git, package.json, pyproject.toml, requirements.txt, pom.xml and similar. Outside a project it falls back to ~/selenium-ai-agent. That is why git init comes first.

Install the agents into the project

One command adds the server to your assistant’s configuration and installs the test agents:

npx selenium-ai-agent init-agents --loop=claude --with-rules

Output:

Selenium AI Agent: test agents for claude (MCP server "selenium-ai-agent")

  wrote .claude/agents/selenium-regression-analyzer.md
  wrote .claude/agents/selenium-test-generator.md
  wrote .claude/agents/selenium-test-healer.md
  wrote .claude/agents/selenium-test-migrator.md
  wrote .claude/agents/selenium-test-planner.md
  added the "selenium-ai-agent" server to .mcp.json

  Rules for AI agents (selenium-python-pytest):
    created CLAUDE.md

Ask your AI assistant to use the selenium-test-planner, -generator or -healer agent.
Run this again after updating selenium-ai-agent to pick up new tools and instructions.

What it wrote:

  • .mcp.json: the MCP server, started with npx -y selenium-ai-agent@latest, so you always run the current version.
  • .claude/agents/*.md: the five agents as Claude Code subagents: planner, generator, healer, migrator and regression analyzer.
  • CLAUDE.md: with --with-rules, a section with Selenium’s own rules for AI coding agents (current Selenium 4 APIs, no sleeps, explicit waits, no driver managers). It sits between selenium-ai-agent:rules markers, so running the command again only replaces that section. Lesson 13 is about these rules.

Other assistants use another --loop:

AssistantCommandAgents go to
Claude Codeinit-agents --loop=claude.claude/agents/
VS Code (Copilot chat modes)init-agents --loop=vscode.github/chatmodes/
GitHub Copilot coding agentinit-agents --loop=copilot.github/agents/
Cursorinit-agents --loop=cursor.cursor/rules/
JetBrains Junieinstall junie --with-rules~/.junie/mcp/mcp.json

For a manual setup, the server entry is the same everywhere, apart from the name of the top-level key (VS Code Copilot uses "servers", the others "mcpServers"):

{
  "mcpServers": {
    "selenium-ai-agent": {
      "command": "npx",
      "args": ["-y", "selenium-ai-agent"]
    }
  }
}

Or for Claude Code from the command line: claude mcp add selenium-ai-agent -- npx -y selenium-ai-agent.

Claude Desktop has one global configuration, not one per project. Install it with npx selenium-ai-agent install claude-desktop --output-dir=~/selenium-agent-practice, so plans and tests go to your practice project and not to ~/selenium-ai-agent.

Check it: doctor

npx selenium-ai-agent doctor

It checks, and prints a fix for anything that fails:

  • the Selenium Manager binary that comes with Selenium
  • Chrome, and which version
  • the driver plan: where the driver will come from (an explicit path, your PATH, the cache, or a download) and where it ends up
  • the proxy and whether the download hosts are reachable
  • the driver cache location (~/.cache/selenium on every operating system)
  • the output folder: where plans, tests and reports will be written

The output folder is the line to read first. If it says ~/selenium-ai-agent while you expected your practice project, the server was started outside the project.

Common problems, and their fixes, are covered in lesson 21: a company proxy, an offline network, a home folder on a network share.

First contact

Start your assistant in the practice folder (for Claude Code: claude). Check that the server is connected (in Claude Code: /mcp), then ask:

Navigate to https://practiceautomatedtesting.com/shopping and tell me what you see.

A Chrome window opens, the shop loads, and the assistant describes the page. That is the loop from lesson 1 working: a tool call, a snapshot, a decision.

Close the browser at the end with:

Close the browser.

Exercise

  1. Run doctor and note the Chrome version, the driver strategy and the output folder.
  2. Open .claude/agents/selenium-test-planner.md (or the file for your assistant). Which tools may the planner use, and what does it say it must do before saving a plan?
Show suggested answer
  1. Your values will differ. The driver strategy is usually cache after the first run (a matching driver was downloaded before) or direct on the very first run. The output folder should be your practice project.
  2. The front matter lists the planner’s tools: browsing (navigate, click, type, select, scroll, wait, tabs, screenshots, console and network logs), reading files in the project, and the planner tools (planner_setup_page, planner_explore_page, planner_save_plan, planner_review_plan, planner_approve_plan). It may not write tests: the generator tools are not on its list. Its instructions start with calling agent_profile (lessons 4 and 16), then explore the application systematically and design scenarios with steps and expected results, covering happy paths, edge cases and errors. The agents are plain Markdown: you can read exactly what they are told to do, and change it for your team.

Your project so far

selenium-agent-practice/
├── .claude/agents/      the five test agents
├── .mcp.json            the MCP server
├── .venv/
└── CLAUDE.md            Selenium's rules for AI agents