Autonomous Web Testing Agent MCP Server
Uses Google Gemini for AI-driven test plan generation and failure analysis, converting natural-language testing requirements into structured Playwright test plans and suggesting recovery actions when test steps fail.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Autonomous Web Testing Agent MCP ServerTest login on saucedemo.com with standard_user and secret_sauce and verify Products page."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Autonomous Web Testing Agent
An AI-powered web testing agent that converts natural-language testing requirements into structured test plans and executes them automatically using Playwright.
The agent uses Google Gemini to generate test plans, handles failed actions with automatic retries, captures failure screenshots, and analyzes failures to provide possible recovery suggestions.
Overview
Traditional test automation requires testers to manually write test scripts and define test steps. This project explores a more AI-driven approach where a user can provide a testing requirement in natural language.
The system then:
Converts the requirement into a structured test plan using Gemini.
Executes the generated steps using Playwright.
Retries failed actions automatically.
Captures a screenshot if an action continues to fail.
Uses Gemini to analyze the failure.
Generates a JSON report containing the test results.
Related MCP server: MCP Macaco Playwright
Features
Converts natural-language testing requirements into structured test plans.
Executes browser tests using Playwright and Chromium.
Supports common browser actions such as navigation, clicking, typing, form submission, and verification.
Automatically retries failed actions.
Captures screenshots for failed test steps.
Uses Gemini AI to analyze failures and suggest possible recovery actions.
Generates JSON test reports.
Supports single and multiple test execution.
Includes MCP tools that expose the testing capabilities of the project.
Uses environment variables to securely manage API keys.
Architecture
Natural Language Requirement
|
v
Gemini AI Planner
|
v
Structured Test Plan
|
v
Playwright Test Runner
|
v
Browser Actions
|
----------------
| |
PASS FAIL
| |
v v
Report Retry Action
|
----------------
| |
Success Final Failure
|
v
Failure Screenshot
|
v
Gemini Failure Analysis
|
v
JSON ReportTech Stack
Python
Google Gemini API
Google GenAI SDK
Playwright
Chromium
Model Context Protocol (MCP)
python-dotenv
JSON
Git and GitHub
Project Structure
ai-autonomous-web-testing-agent/
|
|-- agent/
| |-- planner.py
|
|-- browser/
| |-- playwright_runner.py
|
|-- reports/
| |-- test_report.json
| |-- failure_recovery_report.json
|
|-- screenshots/
| |-- test_failure.png
|
|-- .gitignore
|-- main.py
|-- local_test.py
|-- mcp_server.py
|-- requirements.txt
|-- README.mdNote: The
.envfile is intentionally not included in the repository because it contains the Gemini API key.
Installation
1. Clone the repository
git clone <your-github-repository-url>
cd ai-autonomous-web-testing-agent2. Create a virtual environment
python -m venv venvActivate it on Windows:
venv\Scripts\activate3. Install dependencies
pip install -r requirements.txt4. Install Playwright Chromium
playwright install chromium5. Configure the Gemini API
Create a .env file in the project root:
GEMINI_API_KEY=your_api_key_hereDo not upload or commit the .env file to GitHub.
Running the Agent
Start the application:
python main.pyYou can choose between:
1. Single test
2. Multiple testsEnter a testing requirement in natural language, and the agent will generate and execute the corresponding test plan.
Example
Example requirement:
Open https://www.saucedemo.com, log in using username
standard_user and password secret_sauce, and verify that
the Products page is displayed.The AI generates a structured plan similar to:
1. Navigate to the website
2. Enter the username
3. Enter the password
4. Click the Login button
5. Verify that the Products page is displayedThe Playwright runner then executes these steps automatically.
Example Successful Test
Navigating to: https://www.saucedemo.com
Navigate action passed
Typing 'standard_user' into: #user-name
Type action passed
Typing 'secret_sauce' into: #password
Type action passed
Clicking selector: #login-button
Click action passed
Checking visible text...
Expected: Products
Text verification passed
Status: PASS
Passed steps: 5
Failed steps: 0Failure Handling
When a browser action fails, the agent automatically retries the action.
Action Failed
|
v
Retry Attempt 1
|
v
Retry Attempt 2
|
v
Retry Attempt 3
|
v
Failure Screenshot
|
v
Gemini Failure Analysis
|
v
Recovery SuggestionExample failure analysis:
Action failed after 3 attempts
Screenshot saved: screenshots/test_failure.png
Failure Reason:
The expected text is not present on the page.
Suggested Action:
Update the assertion to match the actual page content.Test Reports
Test results are saved as JSON files in the reports/ directory.
Example:
{
"agent": "Autonomous Web Testing Agent",
"total_tests": 1,
"passed_tests": 1,
"failed_tests": 0,
"overall_status": "PASS"
}The project also includes a separate failure recovery report generated by local_test.py.
MCP Integration
The project includes an MCP server that exposes testing-related tools.
get_testing_capabilities
Returns the browser testing actions supported by the agent.
create_test_requirement_template
Creates a structured testing requirement using a website and task description.
Supported actions include:
navigateclickclick_texttypesubmitverify_titleverify_urlverify_textscreenshot
What This Project Demonstrates
This project demonstrates practical experience with:
Python development
Generative AI
LLM-based task planning
AI agents
Browser automation
Playwright
Test automation
Retry and failure handling
AI-assisted failure analysis
Model Context Protocol (MCP)
API integration
JSON reporting
Future Improvements
Possible future enhancements include:
Automatic selector recovery
Self-healing test steps
Support for additional browser actions
Parallel test execution
Test history and analytics
CI/CD integration
Firefox and WebKit support
Persistent test memory
Advanced MCP integrations
Author
Gayathri U
B.Tech Information Technology
GitHub: Shadowshredder
This server cannot be deployed
Maintenance
Related MCP Connectors
Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…
Turn any webpage into a structured action manifest — clickable, fillable, submittable elements.
Browser-based QA for AI-built software. Test pages with real browsers via agents.
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to automate web browsers through Playwright, providing capabilities for navigation, content extraction, form filling, screenshot capture, and JavaScript execution. Supports multiple browser engines with comprehensive error handling and security features.1-

MCP Macaco Playwrightofficial
AlicenseNot gradedqualityDmaintenanceEnables comprehensive browser automation and web interaction through Playwright with 50+ specialized functions for navigation, form filling, data extraction, and Chrome DevTools Protocol support. Designed specifically for AI agents to perform complex web workflows including scraping, testing, and automated browsing tasks.5 npm1Apache 2.0- AlicenseNot gradedqualityDmaintenanceProvides browser automation capabilities using Playwright, enabling users to navigate websites, extract content, take screenshots, and interact with web pages through natural language prompts.8 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to perform browser automation tasks including web scraping, taking screenshots, and executing JavaScript using Playwright. It facilitates real-time interaction with web pages and the generation of automated test code.13 npmMIT