Cover image
Try Now
2025-04-12

Selenium Webdriver的MCP实施

3 years

Works with Finder

8

Github Watches

13

Github Forks

96

Github Stars

MCP Selenium Server

smithery badge

A Model Context Protocol (MCP) server implementation for Selenium WebDriver, enabling browser automation through standardized MCP clients.

Video Demo (Click to Watch)

Watch the video

Features

  • Start browser sessions with customizable options
  • Navigate to URLs
  • Find elements using various locator strategies
  • Click, type, and interact with elements
  • Perform mouse actions (hover, drag and drop)
  • Handle keyboard input
  • Take screenshots
  • Upload files
  • Support for headless mode

Supported Browsers

  • Chrome
  • Firefox

Use with Goose

Option 1: One-click install

Copy and paste the link below into a browser address bar to add this extension to goose desktop:

goose://extension?cmd=npx&arg=-y&arg=%40angiejones%2Fmcp-selenium&id=selenium-mcp&name=Selenium%20MCP&description=automates%20browser%20interactions

Option 2: Add manually to desktop or CLI

  • Name: Selenium MCP
  • Description: automates browser interactions
  • Command: npx -y @angiejones/mcp-selenium

Use with other MCP clients (e.g. Claude Desktop, etc)

{
  "mcpServers": {
    "selenium": {
      "command": "npx",
      "args": ["-y", "@angiejones/mcp-selenium"]
    }
  }
}

Development

To work on this project:

  1. Clone the repository
  2. Install dependencies: npm install
  3. Run the server: npm start

Installation

Installing via Smithery

To install MCP Selenium for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @angiejones/mcp-selenium --client claude

Manual Installation

npm install -g @angiejones/mcp-selenium

Usage

Start the server by running:

mcp-selenium

Or use with NPX in your MCP configuration:

{
  "mcpServers": {
    "selenium": {
      "command": "npx",
      "args": [
        "-y",
        "@angiejones/mcp-selenium"
      ]
    }
  }
}

Tools

start_browser

Launches a browser session.

Parameters:

  • browser (required): Browser to launch
    • Type: string
    • Enum: ["chrome", "firefox"]
  • options: Browser configuration options
    • Type: object
    • Properties:
      • headless: Run browser in headless mode
        • Type: boolean
      • arguments: Additional browser arguments
        • Type: array of strings

Example:

{
  "tool": "start_browser",
  "parameters": {
    "browser": "chrome",
    "options": {
      "headless": true,
      "arguments": ["--no-sandbox"]
    }
  }
}

navigate

Navigates to a URL.

Parameters:

  • url (required): URL to navigate to
    • Type: string

Example:

{
  "tool": "navigate",
  "parameters": {
    "url": "https://www.example.com"
  }
}

find_element

Finds an element on the page.

Parameters:

  • by (required): Locator strategy
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the locator strategy
    • Type: string
  • timeout: Maximum time to wait for element in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "find_element",
  "parameters": {
    "by": "id",
    "value": "search-input",
    "timeout": 5000
  }
}

click_element

Clicks an element.

Parameters:

  • by (required): Locator strategy
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the locator strategy
    • Type: string
  • timeout: Maximum time to wait for element in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "click_element",
  "parameters": {
    "by": "css",
    "value": ".submit-button"
  }
}

send_keys

Sends keys to an element (typing).

Parameters:

  • by (required): Locator strategy
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the locator strategy
    • Type: string
  • text (required): Text to enter into the element
    • Type: string
  • timeout: Maximum time to wait for element in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "send_keys",
  "parameters": {
    "by": "name",
    "value": "username",
    "text": "testuser"
  }
}

get_element_text

Gets the text() of an element.

Parameters:

  • by (required): Locator strategy
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the locator strategy
    • Type: string
  • timeout: Maximum time to wait for element in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "get_element_text",
  "parameters": {
    "by": "css",
    "value": ".message"
  }
}

hover

Moves the mouse to hover over an element.

Parameters:

  • by (required): Locator strategy
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the locator strategy
    • Type: string
  • timeout: Maximum time to wait for element in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "hover",
  "parameters": {
    "by": "css",
    "value": ".dropdown-menu"
  }
}

drag_and_drop

Drags an element and drops it onto another element.

Parameters:

  • by (required): Locator strategy for source element
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the source locator strategy
    • Type: string
  • targetBy (required): Locator strategy for target element
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • targetValue (required): Value for the target locator strategy
    • Type: string
  • timeout: Maximum time to wait for elements in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "drag_and_drop",
  "parameters": {
    "by": "id",
    "value": "draggable",
    "targetBy": "id",
    "targetValue": "droppable"
  }
}

double_click

Performs a double click on an element.

Parameters:

  • by (required): Locator strategy
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the locator strategy
    • Type: string
  • timeout: Maximum time to wait for element in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "double_click",
  "parameters": {
    "by": "css",
    "value": ".editable-text"
  }
}

right_click

Performs a right click (context click) on an element.

Parameters:

  • by (required): Locator strategy
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the locator strategy
    • Type: string
  • timeout: Maximum time to wait for element in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "right_click",
  "parameters": {
    "by": "css",
    "value": ".context-menu-trigger"
  }
}

press_key

Simulates pressing a keyboard key.

Parameters:

  • key (required): Key to press (e.g., 'Enter', 'Tab', 'a', etc.)
    • Type: string

Example:

{
  "tool": "press_key",
  "parameters": {
    "key": "Enter"
  }
}

upload_file

Uploads a file using a file input element.

Parameters:

  • by (required): Locator strategy
    • Type: string
    • Enum: ["id", "css", "xpath", "name", "tag", "class"]
  • value (required): Value for the locator strategy
    • Type: string
  • filePath (required): Absolute path to the file to upload
    • Type: string
  • timeout: Maximum time to wait for element in milliseconds
    • Type: number
    • Default: 10000

Example:

{
  "tool": "upload_file",
  "parameters": {
    "by": "id",
    "value": "file-input",
    "filePath": "/path/to/file.pdf"
  }
}

take_screenshot

Captures a screenshot of the current page.

Parameters:

  • outputPath (optional): Path where to save the screenshot. If not provided, returns base64 data.
    • Type: string

Example:

{
  "tool": "take_screenshot",
  "parameters": {
    "outputPath": "/path/to/screenshot.png"
  }
}

close_session

Closes the current browser session and cleans up resources.

Parameters: None required

Example:

{
  "tool": "close_session",
  "parameters": {}
}

License

MIT

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • chongdashu
  • 使用模型上下文协议(MCP),启用Cursor,Windsurf和Claude Desktop等AI助手客户,以通过自然语言控制虚幻引擎。

  • wgpsec
  • 一款基于各大企业信息api的工具,解决在遇到的各种针对国内企业信息收集难题。一键收集控股公司icp 备案、 app 、小程序、微信公众号等信息聚合导出。支持 mcp接入

    Reviews

    5 (1)
    Avatar
    user_nVkKFleW
    2025-04-17

    As a dedicated user of mcp-selenium, I am thoroughly impressed with its capabilities and performance. This tool, created by the brilliant Angie Jones, seamlessly integrates with Selenium to enhance test automation. The clear documentation and ease of use make it an invaluable asset for any QA engineer. Highly recommended!