The Agent in a Company Network
Why This Matters
On your own laptop the agent installs in a minute. In a company it meets the real world: a proxy that blocks downloads, a locked-down laptop with an old chromedriver somewhere on the PATH, a home folder on a network share, a security officer who asks where the test data goes, and an AI assistant that could, in principle, write anywhere and click anything.
This lesson is about running the agent there: getting the driver to work, keeping files in the project, keeping secrets out of the AI, and knowing what the agent does and doesn’t protect you from. It brings guardrails 8 and 10 from lesson 4 together with the practical setup.
What you will learn
doctor: what it checks and how to read it- How the driver is obtained, and what to do behind a proxy or offline
- The output folder: where files go and why the agent won’t write elsewhere
- Fewer approval prompts without giving the AI free rein
- Secrets, test data and what goes to the AI provider
- Stealth mode, bot protection and what you may test
Start with doctor
npx selenium-ai-agent doctor
doctor checks everything the agent needs before an AI ever sees it, and prints a concrete fix for every check that fails. A real run, on a machine with Chrome 158 and an old ChromeDriver 147 on its PATH, behind a proxy:
Selenium AI Agent — doctor
[OK] Selenium Manager binary
executable: .../node_modules/selenium-webdriver/bin/linux/selenium-manager
[OK] Chrome installed
Chrome 158.0.8127.88 (major 158)
[OK] Driver provisioning plan
strategy: direct
driver: (will be downloaded to the cache)
url: https://storage.googleapis.com/chrome-for-testing-public/158.0.8127.88/linux64/chromedriver-linux64.zip
skipped /opt/node22/bin/chromedriver: ChromeDriver 147, Chrome is 158
[OK] Proxy reachable
proxy 127.0.0.1:42901 reachable
[OK] Driver cache location
/root/.cache/selenium (will be created on first run)
[OK] Output folder
/home/claude/saa-src/selenium-mcp-server
All checks passed.
Look at the “skipped” line. An old chromedriver on the PATH is common on managed machines, and a driver for another Chrome version starts no session at all: “This version of ChromeDriver only supports Chrome version 147”. The agent skips it and uses the matching driver. (Before 3.9.1 it used the PATH driver whatever its version, and doctor said “All checks passed” while no browser could start: we found that while writing this lesson.)
How the driver is obtained
The agent finds a driver in this order, first match wins:
SE_CHROMEDRIVER: an explicit path to a driver. No network.- A
chromedriveron the PATH, if it matches your Chrome. No network. - A cached driver for your Chrome version (
~/.cache/selenium). No network. - A direct download for your exact Chrome version from the Chrome-for-Testing storage host.
- Selenium Manager’s own discovery, as a fallback.
The direct download deliberately avoids the version metadata host (googlechromelabs.github.io), which is unreachable on some company networks.
For the situations you’ll meet in a company:
| Situation | Setting |
|---|---|
| A proxy | ~/.selenium-ai-agent/config.json: { "proxy": "http://proxy.corp:8080", "noProxy": "localhost,127.0.0.1,.internal" }, or HTTPS_PROXY / NO_PROXY |
| No internet at all (air-gapped) | SE_CHROMEDRIVER=/opt/drivers/chromedriver, kept in step with the Chrome version |
| An internal mirror of the driver downloads | SE_CHROMEDRIVER_MIRROR=https://mirror.corp/chrome-for-testing |
| Home folder on a network share (VMware, mapped drive) | SE_CACHE_PATH on a local disk: the OS may refuse to run a driver from a share |
| A Chrome you started yourself (with your company login) | SELENIUM_ATTACH_CDP=127.0.0.1:9222 to attach instead of launching |
Why a config file for the proxy? An MCP server started by a desktop app (Claude Desktop, VS Code) does not inherit your shell’s environment, so a proxy set in .bashrc never reaches it. The file in your home folder does.
If your proxy needs a user name and password, they go in that file, which stays in your home folder. Never put them in the project, and never commit them.
Files stay in the project
Every tool that writes a file (plans, tests, screenshots, PDFs, reports, analyzer output) checks that the path stays inside the output folder. Ask for a screenshot on the Desktop and you get:
Error: Path ".../Movies/screen-recorder/learning-path.png" resolves outside the output directory
".../selenium-ai-agent". All output files must be within the output directory.
Set SELENIUM_MCP_OUTPUT_DIR to change the output location, or use
--allow-unrestricted-file-access to disable this check.
That is a real refusal from writing this course. The output folder is:
- for Claude Code, VS Code and Cursor with
init-agents: the project the server runs in (the nearest folder with.git,package.json,pom.xml,pyproject.tomland the like); - for clients with one global configuration, such as Claude Desktop:
~/selenium-ai-agent, unless you setSELENIUM_MCP_OUTPUT_DIR(orinstall claude-desktop --output-dir=...).
doctor shows which folder is in use. The one exception is healer_fix_test: it must edit your existing tests, and always keeps a .bak backup.
Don’t use --allow-unrestricted-file-access to get around a refusal. Set the output folder to the project instead.
Fewer prompts, not fewer limits
By default your AI client asks before every tool call. That gets old after twenty clicks, and people start clicking “Allow always” for everything. A better way: every tool tells the client whether it only reads (readOnlyHint) or can change something (destructiveHint). Approve the read-only ones automatically and keep confirming the rest. For Claude Code, in .claude/settings.json:
{
"permissions": {
"allow": [
"mcp__selenium-ai-agent__capture_page",
"mcp__selenium-ai-agent__verify_text_visible",
"mcp__selenium-ai-agent__planner_explore_page"
]
}
}
Fewer tools help too: SELENIUM_MCP_TOOLSETS=core,planner,generator,healer leaves the Grid and analyzer tools out. The AI then can’t call what it doesn’t need.
Secrets and test data
Everything the AI sees goes to your AI provider: the chat, page snapshots, tool results, the plan. Three rules follow:
- No real passwords in the chat, the plan or a test. Use a test account, from environment variables or a logged-in browser profile in the seed (lesson 7).
- Test environments, not production. A page snapshot of production contains production data: customer names, orders, addresses. A test environment with test data doesn’t.
- Check what your company allows. Many companies have rules about which AI services may see which data. The agent can’t decide that for you; the snapshot goes wherever your AI client sends it.
The agent’s own artefacts help keep this tidy: the review page runs only on 127.0.0.1 with a random token, the read-only review copies in .selenium-ai-agent/ are ignored by git, and the session trace (SELENIUM_MCP_SAVE_TRACE) is off unless you turn it on. If you do turn it on, treat traces like logs: they contain page content.
Stealth mode and what you may test
SELENIUM_STEALTH=true (or set_stealth_mode) hides the obvious signs of automation, such as navigator.webdriver and Chrome’s “controlled by automated software” bar. The documentation is explicit about its limit: it does not get past advanced bot protection such as Cloudflare. That is deliberate.
Use the agent on applications you are allowed to test: your own, your employer’s, practice sites. If a site blocks automation, that is the site’s decision; ask its owner for a test environment or an allow-list, don’t look for a way around it.
Exercise
- Run
npx selenium-ai-agent doctoron your work machine. Which strategy does it use for the driver? Is anything skipped? - Where is your output folder? Ask the agent to save a screenshot to your Desktop. What happens? Then set the output folder to your test project and try a screenshot inside it.
- Write down, for your own project: where do the test credentials come from, which environment do you test against, and which AI tool calls do you approve automatically?
Show suggested answer
- Usually
cache(a driver downloaded before) ordirect(it will download one). Behind a strict proxy without a config, the proxy check fails with a fix. If a chromedriver on the PATH is skipped, consider removing it: other tools on the machine may still use it. - The Desktop is outside the output folder, so the tool refuses with the message above. A screenshot inside the project works.
- A good answer is concrete: “Credentials from TEST_USER / TEST_PASSWORD in the CI secret store and a local
.envthat git ignores; tests againsthttps://test.shop.internal; auto-approved:capture_page,verify_*,planner_explore_page; everything that clicks, types or writes files is confirmed.” Put that in the project’s README: it is part of how the team uses the agent.
Exam-style questions
1. The agent runs in Claude Desktop on a laptop behind a company proxy. The proxy is set in ~/.bashrc. Why does the driver download still fail?
- A. The proxy is the wrong one
- B. An MCP server started by a desktop app doesn’t inherit the shell’s environment; put the proxy in
~/.selenium-ai-agent/config.json - C. Chrome is not installed
- D. Selenium Manager doesn’t support proxies
Show answer
2. The agent refuses to save a screenshot to the Desktop. What is the right fix?
- A. Use
--allow-unrestricted-file-access - B. Set the output folder to your project and save it there
- C. Run the agent as administrator
- D. Disable the check in
.selenium-agent.json
Show answer
3. A site blocks the agent with advanced bot protection. What should you do?
- A. Turn on stealth mode until it works
- B. Ask the site’s owner for a test environment or an allow-list; don’t work around it
- C. Use a different browser
- D. Slow the agent down with sleeps