Run this model with HF Jobs
Run TheAutomatedTester/locator-model on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/TheAutomatedTester/locator-model. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/TheAutomatedTester/locator-model on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use TheAutomatedTester/locator-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use TheAutomatedTester/locator-model with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('feature-extraction', 'TheAutomatedTester/locator-model');
Upload README.md with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182# WebMCP-Selenium
A local **Model Context Protocol (MCP)** server that combines **Selenium** browser automation with a **local ML model** (via [Transformers.js](https://huggingface.co/docs/transformers.js)) to crawl a website, analyse its DOM, and generate a prioritised list of test candidates.
---
## Quick Start
Get up and running in 5 minutes:
```bash# 1. Install dependenciesnpm install
# 2. Build the projectnpm run build
# 3. Start the MCP servernpm start```
Then configure your MCP client (e.g., Claude Desktop) to use this server—see [Client Configuration](#client-configuration) below.
For detailed usage examples and API reference, see [USAGE.md](USAGE.md).
---
## Key Features
- **Automated Web Crawling**: Headless Chrome via Selenium extracts pages and DOM structure- **Intelligent Element Analysis**: ML-powered semantic scoring identifies high-risk/high-value elements on the page- **Test Case Generation**: Automatically generates structured test cases with: - Priority levels (critical, high, medium, low) based on intent scores - Action type detection (click, input, submit, form interaction, etc.) - Contextual preconditions and expected results - Semantic tool references for execution- **Semantic WebMCP Tools**: Auto-generated domain-specific tools for browser-side execution- **Multiple Output Formats**: JSON, detailed Markdown reports, or summary Markdown- **Natural Language Locators**: Find stable CSS/XPath selectors for any element by describing it
---
## Documentation Map
| Document | Use Case ||----------|----------|| **This README** | Project overview, quick start, MCP tool reference || **[USAGE.md](USAGE.md)** | Comprehensive guide to using the library, API reference, examples, troubleshooting || **[DEVELOPMENT.md](DEVELOPMENT.md)** | Instructions for contributors: setup, architecture, development workflow, adding features || **[CONTRIBUTING.md](CONTRIBUTING.md)** | Guidelines for reporting issues and submitting pull requests |
See [ANALYSIS_BSTACKDEMO.md](ANALYSIS_BSTACKDEMO.md) for a real-world example of crawl results.
---
## Architecture
Core modules that work together:
| File | Responsibility ||---|---|| `src/crawler.ts` | `SiteCrawler` – headless Chrome via Selenium, extracts DOM snapshots || `src/analyzer.ts` | `DomAnalyzer` – semantic ML scoring identifies high-risk elements via `Xenova/all-MiniLM-L6-v2` || `src/test-case-generator.ts` | `TestCaseGenerator` – creates structured test cases from high-intent elements || `src/webmcp-semantic-tools.ts` | `SemanticToolGenerator` – auto-generates domain-specific MCP tools || `src/webmcp-semantic-handlers.ts` | `SemanticHandlerGenerator` – creates browser-side handlers for tools || `src/aria-collector.ts` | `collectAriaSnapshot` – runs in the page; resolves roles, focusability, names and id references for elements carrying ARIA || `src/aria-auditor.ts` | `auditAriaSnapshot` – advisory ARIA rules; for each problem, the user impact, advice and what removing the ARIA would lose || `src/markdown-exporter.ts` | `MarkdownExporter` – formats output in multiple formats (JSON/Markdown) || `src/test-executor.ts` | `TestExecutor` – orchestrates test execution in browser context || `src/index.ts` | MCP server entry point; exposes three MCP tools over stdio |
---
## Prerequisites
- Node.js ≥ 18- Google Chrome installed (Selenium Manager handles chromedriver automatically)
---
## Development Setup
For detailed setup and development workflow, see [DEVELOPMENT.md](DEVELOPMENT.md).
Quick build variants:
```bashnpm run build # Compile TypeScriptnpm run build:browser # Compile analyzer for browser injectionnpm start # Build + start MCP servernpm run dev # Run with tsx (no build step)npm test # Run test suites```
---
## MCP Tools
### 1. `crawl_and_analyze`
Crawls a URL with headless Chrome, analyses the DOM, flags brittle elements, and generates test cases.
**Input**
```json{ "url": "https://example.com", "outputFormat": "json"}```
**Output**: Prioritised test cases with intent scores, action types, and preconditions. See [USAGE.md](USAGE.md#crawl_and_analyze) for full documentation and examples.
### 2. `get_element_locator`
Returns the most stable CSS/XPath locator for an element described in natural language, based on the most recent crawl.
**Input**
```json{ "description": "the submit button in the login form"}```
**Output**: Stable CSS or XPath locator string. See [USAGE.md](USAGE.md#get_element_locator) for examples.
Elements are matched by meaning as well as by shared words, so "checkout button" can find a button labelled "Proceed to payment". This uses a local embedding model (`Xenova/all-MiniLM-L6-v2`, about 23 MB, downloaded from Hugging Face on first use). Set `WEBMCP_SEMANTIC_LOCATOR=off` to use keyword matching only. To train your own model for this, see [training/README.md](training/README.md).
### 3. `run_critical_tests`
Executes high-priority test cases (intent score ≥ 50) using auto-generated semantic tools. Tests are run directly in browser via native DOM APIs.
**Input**
```json{ "testIds": ["test-1", "test-2"]}```
**Output**: Test execution results with pass/fail status and assertions. See [USAGE.md](USAGE.md#run_critical_tests) for details.
### 4. `audit_aria`
Advisory review of the ARIA on a page. The first rule of ARIA is that no ARIA is better than bad ARIA, and this tool points out the bad ARIA: roles, states and references likely to mislead someone using a screen reader, voice control or a keyboard.
It only runs when requested, either by calling `audit_aria` or by passing `"ariaAudit": true` to `crawl_and_analyze`. It gives advice and never fails a run.
**Input**
```json{ "url": "https://example.com", "format": "markdown"}```
**Output**: An advisory per problem. Each one gives:
- what is wrong;- what a user experiences;- what to do instead;- what would be lost if the ARIA were simply removed.
Advisories where deleting the ARIA loses nothing are counted separately. See [USAGE.md](USAGE.md#tool-4-audit_aria).
---
## Client Configuration
Add the following to your `claude_desktop_config.json` (or equivalent MCP client settings):
```json"web-mcp-selenium": { "command": "node", "args": ["/path/to/project/build/index.js"]}```
Replace `/path/to/project` with the absolute path to this repository.README.mdAdded+182