π 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.