๐ญ Transform natural language into browser automation with Selenium MCP Server. Write tests in plain English - no complex locators needed! Demo includes complete e-commerce flow automation.
๐ญ Selenium MCP Server Configuration & Demo
Transform Natural Language into Browser Automation Magic โจ
๐ Table of Contents
- ๐ Overview
- โ๏ธ Setup Guide
- ๐ฏ Magic Prompt Demo
- ๐ How It Works
- ๐ป Tech Stack
- ๐ Running Tests
- โจ Key Features
- ๐จโ๐ป Author
๐ Overview
Welcome to the future of test automation! This project showcases the revolutionary Selenium MCP Server, which transforms natural language commands into sophisticated browser automation workflows. Say goodbye to complex XPath expressions and hello to plain English test creation! ๐
โ๏ธ Setup Guide
๐ Step 1: Create Project Workspace
# Open VSCode and create a new folder for your project
๐ง Step 2: Configure MCP Server
Navigate to: C:\Users\mvsar\AppData\Roaming\Code\User\mcp.json
Add the following configuration:
{
"mcpServers": {
"selenium": {
"command": "npx",
"args": [
"-y",
"@angiejones/mcp-selenium"
]
}
}
}
๐ฆ Step 3: Install MCP Package
npm install -g @angiejones/mcp-selenium
๐๏ธ Step 4: Generate Maven Project
Open Command Prompt in VSCode terminal and run:
mvn archetype:generate -DgroupId=com.selenium.mcp -DartifactId=selenium-mcp-tests -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
๐ Project Structure Created:
selenium-mcp-tests/
โโโ src/
โ โโโ main/
โ โ โโโ java/
โ โโโ test/
โ โโโ java/
โโโ pom.xml
๐ Step 5: Update pom.xml
Add these dependencies and plugins:
<dependencies>
<!-- Selenium WebDriver -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.15.0</version>
</dependency>
<!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<scope>test</scope>
</dependency>
<!-- WebDriverManager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.6.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
๐ Step 6: Install Dependencies
cd selenium-mcp-tests
mvn clean install
๐ฆ Step 7: Start MCP Server
๐ด CRITICAL: Server must be running before generating tests!
-
Open VS Code Command Palette:
- Windows/Linux:
Ctrl + Shift + P - macOS:
Cmd + Shift + P
- Windows/Linux:
-
Type:
MCP: List Servers -
Find
seleniumin the server list -
Click Start button
-
โ Verify status shows "Running" with green indicator
๐ฏ Magic Prompt Demo
๐ช The Single Command That Does It All
use selenium mcp server visit https://www.demoblaze.com/
select Samsung galaxy s6 product
add to the cart and checkout
That's it! Watch as the MCP Server:
- ๐ Launches the browser
- ๐ Navigates to the website
- ๐ฏ Identifies product elements
- ๐ Handles cart operations
- โ Completes checkout flow
- ๐งช Generates test code automatically
๐ How It Works
๐จ Automation Flow
graph TD
A[๐ค Natural Language Input] --> B[๐ง MCP Server Processing]
B --> C[๐ Element Detection]
C --> D[๐ Browser Launch]
D --> E[๐ช Navigate to DemoBlaze]
E --> F[๐ฑ Select Samsung Galaxy S6]
F --> G[๐ Add to Cart]
G --> H[๐ณ Checkout Process]
H --> I[โ
Test Generation]
I --> J[๐ Verification Complete]
โก Key Automation Steps
| Step | Action | MCP Handling | |------|--------|--------------| | 1๏ธโฃ | Browser Launch | Automatic driver management | | 2๏ธโฃ | Navigation | URL routing & page load wait | | 3๏ธโฃ | Product Selection | Smart element identification | | 4๏ธโฃ | Cart Management | Click handling & alerts | | 5๏ธโฃ | Checkout | Form interactions & submission | | 6๏ธโฃ | Verification | Test code generation |
๐ป Tech Stack
|
Java 21 |
Selenium |
TestNG |
Maven |
|
WebDriverManager |
Selenium MCP |
VS Code |
NPX |
๐ Running Tests
๐ฌ Open GitHub Copilot in VS Code
Simply type your natural language command:
use selenium mcp server visit https://www.demoblaze.com/
select Samsung galaxy s6 product
add to the cart and checkout
๐ฌ What Happens Next:
- ๐ค MCP Server interprets your command
- ๐ Browser launches automatically
- ๐ Consent prompt appears (grant permission)
- โก Automation executes the workflow
- ๐ Test code is generated automatically
- โ Verification completes
โจ Key Features
๐ฏ Core Benefits
| Feature | Description | Impact | |---------|-------------|--------| | ๐ Natural Language | Write tests in plain English | 10x faster test creation | | ๐ Smart Detection | Automatic element identification | No locator maintenance | | โฑ๏ธ Auto-Timing | Intelligent wait mechanisms | No explicit waits needed | | ๐จ Alert Handling | Built-in popup management | Seamless flow handling | | ๐ Synchronization | Smart state management | Reduced flakiness | | ๐จ Code Generation | Creates maintainable tests | Professional quality code |
๐ Why This Matters
Traditional Approach ๐
driver.get("https://www.demoblaze.com/"); WebDriverWait wait = new WebDriverWait(driver, 10); WebElement product = wait.until(ExpectedConditions.elementToBeClickable( By.xpath("//a[contains(text(),'Samsung galaxy s6')]"))); product.click(); // ... 50+ more lines of code
MCP Server Approach ๐
use selenium mcp server visit https://www.demoblaze.com/ select Samsung galaxy s6 product add to the cart and checkout
๐ Results & Achievements
โ Complete E-Commerce Flow Automated
- ๐ช Product browsing
- ๐ Cart management
- ๐ณ Checkout process
- โจ Alert handling
- ๐ Data validation
๐ Metrics
- Lines of Code: 1 prompt vs 100+ lines
- Development Time: 2 minutes vs 2 hours
- Maintenance: Minimal vs High
- Readability: English vs Technical
๐จ Test Scenario Visualization
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Browser Launch โ
โ โ โ
โ ๐ช Visit DemoBlaze Store โ
โ โ โ
โ ๐ Browse Products โ
โ โ โ
โ ๐ฑ Select Samsung Galaxy S6 โ
โ โ โ
โ ๐ Add to Cart โ
โ โ โ
โ ๐จ Handle Alert โ
โ โ โ
โ ๐ณ Navigate to Checkout โ
โ โ โ
โ ๐ Complete Purchase Form โ
โ โ โ
โ โ
Verification & Test Generation โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Success Story
This demo proves that natural language automation is not just a conceptโit's a reality! The Selenium MCP Server bridges the gap between human intent and browser automation, making test creation accessible to everyone from developers to QA analysts to product managers.
๐ Learning Resources
๐ค Contributing
Found this helpful? Star โญ the repository and share your experience!
๐ License
This project is open source and available for educational purposes.