Playwright-Style Test Agents for Selenium: An R&D Experiment
Note: This project selenium_mcp_server – supportwithagents branch is experimental and not fully tested yet. It is purely R&D – not a production-ready solution.
I also don’t work in a Selenium-based team. I built this out of curiosity to explore a question: Can Playwright’s Test Agent system be recreated for Selenium, with support for multiple languages and frameworks?
Why I Did This
When Microsoft released Playwright v1.56 with the Planner, Generator & Healer agents, I was impressed. Their agents don’t just read code – they explore a real browser, observe feedback, and make decisions.
Through this experiment, I now understand how Playwright Test Agents work in depth, including:
- How they use tools and browser feedback loops
- How test plans are generated using real observations
- Why AI + browser context creates smarter automation
The R&D Challenge
Could I recreate Playwright’s Test Agents using Selenium instead and make it work across multiple testing frameworks?
This is not:
- a team-driven project
- a mature Selenium toolkit
- a fully validated solution
This is:
- a proof-of-concept
- a learning experiment
- an exploration of AI + browser automation
What Was Built
| Playwright Feature | My Selenium Version |
|---|---|
| Planner Agent | selenium-test-planner.agent.md |
| Generator Agent | selenium-test-generator.agent.md |
| Healer Agent | selenium-test-healer.agent.md |
| Output Formats | pytest, unittest, WebdriverIO, Robot Framework |
| Exploration Depths | 5 modes (quick -> full site) |
| Browser Tools | 40+ MCP tools |
Simple Workflow: “Test this website”
What You See vs What Happens Behind the Scenes
YOU TYPE: “Test this website “https://practiceautomatedtesting.com/"
Claude Code calls: planner_setup_page
### Page state
- Page URL: https://practiceautomatedtesting.com
- Page Title: Example Domain
- Page Snapshot:
```yaml
a "More information..." [ref=e1] [role=link]
- button "Login" [ref=e2] [role=button]
- input "Email" [ref=e3]
- input "Password" [ref=e4]
- button "Submit" [ref=e5] [role=button]
Claude Code analyzes what it sees and decides: “I see a login form. Let me click around to understand the site.”
Claude calls: click_element
Clicked: More information link
### Page state
- Page URL: https://practiceautomatedtesting.com/info
- Page Title: Information Page
- Page Snapshot:
```yaml
- a "Home" [ref=e1]
- a "Contact" [ref=e2]
- h1 "About Us" [ref=e3] [level=1]
After exploring, Claude thinks: “I found:
- Login form
- Information page
- Contact page
- Navigation links
Let me create test scenarios for these.”
Claude calls: planner_save_plan
Test plan created!
I've explored https://practiceautomatedtesting.com and c
created a comprehensive test plan covering:
1. Login functionality
- Valid credentials
- Invalid credentials
- Empty fields
2. Navigation
- Information page
- Contact page
- Back to home
3. Form validation
- Email format
- Password requirements
Test plan saved to:
test-plans/website-functionality.plan.md
Would you like me to generate executable tests from this?
Example – Generated Test Plan
# Scenario: Add Item to Cart
Steps:
1. Navigate to /shopping
2. Click "Add to Cart"
3. Verify cart shows "1"
4. Open cart
5. Check product & price
Example – Selenium PyTest Output
def test_add_single_item(driver):
driver.get("https://practiceautomatedtesting.com/shopping")
add_btn = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, "[data-testid='add-cart-btn']"))
)
add_btn.click()
cart_count = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, ".cart-count"))
)
assert cart_count.text == "1"
What I Learned
Rebuilding this agents system taught me how Playwright agents work internally, especially:
- The tool feedback loop mechanism
- Structured prompts and task workflows
- Why real-time selector validation is critical
- How Markdown test plans are the perfect AI-friendly test layer
Important Disclaimer
This project is not fully tested yet. It may work well on some flows and fail on others – that’s expected in early R&D. Right now, it should be seen as:
- an experiment
- an idea worth exploring
- a way to understand Playwright Agents by rebuilding them
Final Takeaway
Even if it never becomes a production tool, this experiment succeeded.
It showed that:
- Agent-driven testing can work in Selenium
- Browser feedback loops are powerful
- Playwright’s architecture can be adapted
- Multisupported scripts in various languages like Python, javascript, Robot Framework, Typescript, as long as it is selenium
- The best way to understand something – is to try building it yourself
if you want to experiment please check out this branch selenium_mcp_server – supportwithagents branch
R&D isn’t about finished tools. It’s about discovering what’s possible.
Instruction installation for claude code can be found in the repo (vscode en cursor support will be there shortly)
Ralph van der Horst
Test automation consultant and builder of selenium-ai-agent and Robotyxx. Writes about AI, test automation and RPA from hands-on project work. More about me →
Related articles
- Parallel Test Execution in Playwright: Workers and Sharding
Cut Playwright suite runtime by up to 70-80% with workers, fullyParallel and sharding across CI machines, from a basic setup to advanced …
- Getting Started with selenium-ai-agent (Selenium MCP)
Install selenium-ai-agent, the MCP server with 73 tools that lets Claude, Copilot and Cursor drive a real browser, and automate your first …
- We Moved Our Playwright Tests Off GitHub Actions to a European Serverless Cloud. Here's What Happened.
Running Playwright on Scaleway serverless costs about 5-8x less per run than GitHub Actions and keeps your data in Paris. The price is …