Skip to main content
Glama

MCP Selenium

MCP Selenium 服务器

Selenium WebDriver 的模型上下文协议 (MCP) 服务器实现,通过标准化 MCP 客户端实现浏览器自动化。

特征

  • 使用可自定义的选项启动浏览器会话
  • 导航至 URL
  • 使用各种定位器策略查找元素
  • 单击、键入并与元素交互
  • 执行鼠标操作(悬停、拖放)
  • 处理键盘输入
  • 截取屏幕截图
  • 上传文件
  • 支持无头模式

支持的浏览器

  • 铬合金
  • 火狐

与 Goose 一起使用

选项 1:一键安装

将以下链接复制并粘贴到浏览器地址栏中,以将此扩展程序添加到 goose 桌面:

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

选项 2:手动添加到桌面或 CLI

  • 名称: Selenium MCP
  • 描述: automates browser interactions
  • 命令: npx -y @angiejones/mcp-selenium

与其他 MCP 客户端一起使用(例如 Claude Desktop 等)

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

发展

从事此项目:

  1. 克隆存储库
  2. 安装依赖项: npm install
  3. 运行服务器: npm start

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 MCP Selenium:

npx -y @smithery/cli install @angiejones/mcp-selenium --client claude
手动安装
npm install -g @angiejones/mcp-selenium

用法

通过运行以下命令启动服务器:

mcp-selenium

或者在您的 MCP 配置中与 NPX 一起使用:

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

工具

启动浏览器

启动浏览器会话。

参数:

  • browser (必需):要启动的浏览器
    • 类型:字符串
    • 枚举:[“chrome”,“firefox”]
  • options :浏览器配置选项
    • 类型:对象
    • 特性:
      • headless :以无头模式运行浏览器
        • 类型:布尔值
      • arguments :附加浏览器参数
        • 类型:字符串数组

例子:

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

导航

导航至某个 URL。

参数:

  • url (必填):导航到的 URL
    • 类型:字符串

例子:

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

查找元素

在页面上查找元素。

参数:

  • by (必需):定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):定位器策略的值
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

click_element

单击一个元素。

参数:

  • by (必需):定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):定位器策略的值
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

发送密钥

将键发送到元素(键入)。

参数:

  • by (必需):定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):定位器策略的值
    • 类型:字符串
  • text (必需):输入到元素中的文本
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

获取元素文本

获取元素的文本()。

参数:

  • by (必需):定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):定位器策略的值
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

徘徊

移动鼠标悬停在元素上。

参数:

  • by (必需):定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):定位器策略的值
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

拖放

将一个元素拖放到另一个元素上。

参数:

  • by (必需):源元素的定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):源定位器策略的值
    • 类型:字符串
  • targetBy (必需):目标元素的定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • targetValue (必需):目标定位器策略的值
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

双击

对元素执行双击。

参数:

  • by (必需):定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):定位器策略的值
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

右键单击

对元素执行右键单击(上下文单击)。

参数:

  • by (必需):定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):定位器策略的值
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

按键

模拟按下键盘键。

参数:

  • key (必需):要按下的键(例如,“Enter”,“Tab”,“a”等)
    • 类型:字符串

例子:

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

upload_file

使用文件输入元素上传文件。

参数:

  • by (必需):定位器策略
    • 类型:字符串
    • 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
  • value (必需):定位器策略的值
    • 类型:字符串
  • filePath (必需):要上传的文件的绝对路径
    • 类型:字符串
  • timeout :等待元素的最长时间(以毫秒为单位)
    • 类型:数字
    • 默认值:10000

例子:

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

截屏

捕获当前页面的屏幕截图。

参数:

  • outputPath (可选):屏幕截图的保存路径。若未提供,则返回 base64 数据。
    • 类型:字符串

例子:

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

关闭会话

关闭当前浏览器会话并清理资源。

**参数:**无必填

例子:

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

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

通过 MCP 使用 Selenium WebDriver 实现浏览器自动化,支持浏览器管理、元素定位以及基本和高级用户交互。

  1. 特征
    1. 支持的浏览器
      1. 与 Goose 一起使用
        1. 选项 1:一键安装
        2. 选项 2:手动添加到桌面或 CLI
      2. 与其他 MCP 客户端一起使用(例如 Claude Desktop 等)
        1. 发展
          1. 安装
          2. 用法
        2. 工具
          1. 启动浏览器
          2. 导航
          3. 查找元素
          4. click\_element
          5. 发送密钥
          6. 获取元素文本
          7. 徘徊
          8. 拖放
          9. 双击
          10. 右键单击
          11. 按键
          12. upload\_file
          13. 截屏
          14. 关闭会话
        3. 执照

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            Facilitates browser automation with custom capabilities and agent-based interactions, integrated through the browser-use library.
            Last updated -
            1
            541
            Python
            MIT License
            • Apple
          • A
            security
            F
            license
            A
            quality
            Enables browser automation using Python scripts, offering operations like taking webpage screenshots, retrieving HTML content, and executing JavaScript.
            Last updated -
            4
            18
            Python
            • Linux
          • A
            security
            A
            license
            A
            quality
            Enables browser automation with Puppeteer, supporting navigation, form interactions, and connection to active Chrome instances for comprehensive web page interaction.
            Last updated -
            8
            470
            8
            TypeScript
            MIT License
            • Apple
            • Linux
          • -
            security
            -
            license
            -
            quality
            A tool that enables automated browser control using Pyppeteer within the MCP framework, allowing navigation, screenshot capture, and element interaction with websites.
            Last updated -
            Python
            Apache 2.0

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/angiejones/mcp-selenium'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server