LocatorLabs MCP Server
Works in VS Code with GitHub Copilot's Agent mode to generate Playwright locators, analyze pages, create Page Object Models, and run/generate test automation scripts through natural language chat.
Generates Page Object Model classes and test scripts in JavaScript for Playwright test automation, with support for intelligent locator generation and reliability rankings.
Generates Page Object Model classes and test scripts in Python for Playwright test automation, with support for intelligent locator generation and reliability rankings.
Generates Page Object Model classes and test scripts in TypeScript for Playwright test automation, with support for intelligent locator generation and reliability rankings.
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., "@LocatorLabs MCP Server get all locators for the login button on https://www.saucedemo.com"
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.
LocatorLabs MCP Server
🎯 Intelligent Playwright locator generation powered by AI
An MCP (Model Context Protocol) server that provides smart locator generation for Playwright test automation.
Works directly in VS Code (with GitHub Copilot), Cursor, Windsurf, Cline, and Claude Desktop. No extra apps needed - just your favorite IDE!
⚡ Quick Install
VS Code (v1.99+) - Copy & run in terminal:
code --add-mcp '{"name":"locatorlabs","command":"npx","args":["-y","locatorlabs-mcp"]}'Cursor:
cursor --add-mcp '{"name":"locatorlabs","command":"npx","args":["-y","locatorlabs-mcp"]}'Windows PowerShell:
code --add-mcp '{\"name\":\"locatorlabs\",\"command\":\"npx\",\"args\":[\"-y\",\"locatorlabs-mcp\"]}'✨ Features
Feature | Description |
🎯 Get Locators | Get all possible locators for any element (Playwright + Selenium formats) |
📊 Analyze Page | Scan pages and identify all interactive elements |
🏗️ Generate POM | Auto-generate Page Object classes for Playwright & Selenium |
✅ Run Tests | Execute Playwright tests and get pass/fail results |
📝 Generate Tests | Create executable test scripts |
Related MCP server: RunAutomation MCP Server
🔧 Supported Frameworks
Framework | Locators | Page Object Model |
Playwright | ✅ | ✅ TypeScript, JavaScript, Python |
Selenium | ✅ | ✅ Java, Python, C# |
🚀 Quick Start
For VS Code (v1.99+ with GitHub Copilot)
One-Line Install (Mac/Linux):
code --add-mcp '{"name":"locatorlabs","command":"npx","args":["-y","locatorlabs-mcp"]}'One-Line Install (Windows PowerShell):
code --add-mcp '{\"name\":\"locatorlabs\",\"command\":\"npx\",\"args\":[\"-y\",\"locatorlabs-mcp\"]}'Or Manual Setup:
Open Command Palette (
Cmd+Shift+P/Ctrl+Shift+P)Type:
MCP: Add ServerSelect:
Command (stdio)Command:
npxArgs:
-y locatorlabs-mcp
Using with GitHub Copilot:
Enable Agent Mode: Settings → Search
chat.agent.enabled→ EnableOpen Copilot Chat (
Ctrl+Cmd+I/Ctrl+Alt+I)Switch to Agent mode (dropdown at top)
Chat: "Get locators for login button on https://saucedemo.com"
For Claude Desktop
Step 1: Open config file
Mac:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Step 2: Add this configuration:
{
"mcpServers": {
"locatorlabs": {
"command": "npx",
"args": ["-y", "locatorlabs-mcp"]
}
}
}Step 3: Restart Claude Desktop
For Cursor IDE
One-Line Install:
cursor --add-mcp '{"name":"locatorlabs","command":"npx","args":["-y","locatorlabs-mcp"]}'Or Manual: Go to Cursor Settings → MCP → Add new MCP Server
Name:
locatorlabsCommand:
npx -y locatorlabs-mcp
For VS Code + Cline Extension
Add to Cline MCP settings:
{
"mcpServers": {
"locatorlabs": {
"command": "npx",
"args": ["-y", "locatorlabs-mcp"]
}
}
}📖 Usage Examples
Just chat naturally:
Get Locators for an Element
"Get me all locators for the login button on https://www.saucedemo.com"
Response:
Type | Locator | Reliability |
testId |
| 98% |
role |
| 95% |
id |
| 90% |
Analyze Entire Page
"Analyze all form elements on https://www.saucedemo.com"
Generate Page Object Model
Playwright:
"Generate a TypeScript Page Object for https://www.saucedemo.com and call it LoginPage"
Selenium:
"Generate a Java Selenium Page Object for https://www.saucedemo.com and call it LoginPage"
"Generate a C# Selenium Page Object for https://www.saucedemo.com called LoginPage"
"Generate a Python Selenium POM for https://www.saucedemo.com named LoginPage"
Run a Test
"Run a test that logs into saucedemo.com with standard_user and secret_sauce, then verify Products page appears"
Response:
✅ Test PASSED (3.2s)
- Navigate to login page ✅
- Enter username ✅
- Enter password ✅
- Click login ✅
- Verify Products visible ✅Generate Test Script
"Generate a Python test script for the saucedemo login flow"
🛠️ Available Tools
Tool | Description |
| Get all possible locators (Playwright + Selenium formats) |
| List all interactive elements on a page |
| Create POM class (Playwright: TS/JS/Python, Selenium: Java/Python/C#) |
| Execute tests in real browser, get pass/fail |
| Generate executable test scripts |
📦 Supported Languages for Page Objects
Language | Framework | Example Output |
| Playwright |
|
| Playwright |
|
| Playwright |
|
| Selenium |
|
| Selenium |
|
| Selenium |
|
🎯 Supported Test Actions
Action | Description |
| Go to URL |
| Click element |
| Enter text |
| Clear input field |
| Toggle checkbox |
| Select dropdown option |
| Mouse hover |
| Keyboard key press |
| Verify element visible |
| Verify element hidden |
| Verify text content |
| Verify input value |
| Verify page URL |
| Verify page title |
| Wait for time |
| Wait for element |
| Capture screenshot |
🏆 Locator Priority
LocatorLabs ranks locators by reliability:
data-testid (98%) - Best, explicitly for testing
Role + Name (95%) - Playwright recommended
Label (90%) - Accessible
ID (90%) - Stable if meaningful
Placeholder (85%) - Good for inputs
Text (75%) - May change
CSS (60%) - Can be brittle
XPath (40%) - Avoid unless necessary
🔄 LocatorLabs vs Playwright MCP
Feature | Playwright MCP | LocatorLabs MCP |
Get all locators for element | ❌ | ✅ |
Locator reliability ranking | ❌ | ✅ |
Selenium locator format | ❌ | ✅ |
Generate Playwright POM | ❌ | ✅ |
Generate Selenium POM (Java/C#/Python) | ❌ | ✅ |
Run tests with pass/fail | ❌ | ✅ |
Browser automation | ✅ | ✅ |
Device emulation | ✅ | ❌ |
They work great together! Use Playwright MCP for navigation/scraping, LocatorLabs MCP for locators/POMs/tests.
📋 Requirements
Node.js 18+
Playwright browsers (auto-installed on first run)
🔧 Troubleshooting
Playwright browsers not installed
npx playwright install chromiumPermission issues on Mac
chmod +x ~/.npm/_npx/*/node_modules/.bin/locatorlabs-mcpView logs (Claude Desktop)
tail -f ~/Library/Logs/Claude/mcp*.logAuto-approve tools in VS Code
Add to settings.json:
{
"chat.tools.autoApprove": true
}🤝 Contributing
Contributions welcome! Please open an issue or PR on GitHub.
📺 Author
Naveen AutomationLabs
YouTube: @naveenautomationlabs (500K+ subscribers)
Website: naveenautomationlabs.com
LinkedIn: Naveen AutomationLabs
📄 License
MIT
Available Tools
5 toolsanalyze_pageB
Analyze an entire webpage and return all interactive elements with their best locators. Use this to understand page structure or get all elements at once.
Inputs: url (required), elementTypes.
generate_page_objectC
Generate a complete Page Object Model class for a webpage. Supports Playwright (TypeScript/JavaScript/Python) and Selenium (Java/Python/C#).
Inputs: url (required), className (required), language.
generate_testB
Generate a Playwright test script from test steps. Returns executable code that can be saved and run independently.
Inputs: testName (required), steps (required), language.
get_locatorsB
Get all possible Playwright locators for a specific element on a webpage. Returns ranked locators with reliability scores. Use this when user asks for locators for a specific element.
Inputs: url (required), elementDescription (required).
run_testB
Execute a Playwright test with given steps and return pass/fail results. Use this to actually run and verify tests in a real browser.
Inputs: testName (required), steps (required), options.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a distinct, non-overlapping purpose: analyze_page for page-wide element analysis, generate_page_object for POM generation, generate_test for test script creation, get_locators for element-specific locator retrieval, and run_test for test execution. The descriptions clearly differentiate their scopes (e.g., get_locators is for specific elements vs. analyze_page for entire pages), eliminating ambiguity.
All tool names follow a consistent verb_noun pattern with snake_case (e.g., analyze_page, generate_page_object, run_test). The verbs are action-oriented and descriptive (analyze, generate, get, run), creating a predictable and readable naming convention throughout the set.
With 5 tools, the server is well-scoped for its purpose of web automation and testing support. Each tool serves a unique function in the workflow (analysis, POM generation, test creation, locator retrieval, test execution), and none feel redundant or missing, making the count appropriate for the domain.
The toolset covers core web automation workflows comprehensively: analysis, POM generation, test creation, locator retrieval, and test execution. A minor gap exists in lacking direct element interaction tools (e.g., click_element or fill_form), but agents can work around this by using generated tests or locators, and the overall surface supports end-to-end testing tasks effectively.
Maintenance
Related MCP Connectors
Approved test intent, reviewed Playwright automation and run evidence, inside your editor.
Write, run and check natural-language browser tests of your web app from your AI assistant.
No-code, AI-assisted UI testing: record new tests, run existing ones, and monitor the results.
Playwright selector risk checks with healing suggestions and receipts.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to inspect, debug, and test web pages using Playwright. Provides comprehensive DOM inspection, visibility debugging, layout validation, and element finding capabilities in real browser environments.3471 npm5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to execute browser automation, perform QA tasks, and generate test code through natural language commands using Playwright.7MIT
- AlicenseNot gradedqualityDmaintenanceAutomates repository analysis, test planning, and generation of end-to-end tests with Playwright, acting as an intelligent quality assistant.13 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI-powered web test automation with self-healing locators and automatic GitHub checkin.-