MCP Selenium 服务器
Selenium WebDriver 的模型上下文协议 (MCP) 服务器实现,通过标准化 MCP 客户端实现浏览器自动化。
特征
- 使用可自定义的选项启动浏览器会话
- 导航至 URL
- 使用各种定位器策略查找元素
- 单击、键入并与元素交互
- 执行鼠标操作(悬停、拖放)
- 处理键盘输入
- 截取屏幕截图
- 上传文件
- 支持无头模式
支持的浏览器
- 铬合金
- 火狐
与 Goose 一起使用
选项 1:一键安装
将以下链接复制并粘贴到浏览器地址栏中,以将此扩展程序添加到 goose 桌面:
选项 2:手动添加到桌面或 CLI
- 名称:
Selenium MCP
- 描述:
automates browser interactions
- 命令:
npx -y @angiejones/mcp-selenium
与其他 MCP 客户端一起使用(例如 Claude Desktop 等)
发展
从事此项目:
- 克隆存储库
- 安装依赖项:
npm install
- 运行服务器:
npm start
安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 MCP Selenium:
手动安装
用法
通过运行以下命令启动服务器:
或者在您的 MCP 配置中与 NPX 一起使用:
工具
启动浏览器
启动浏览器会话。
参数:
browser
(必需):要启动的浏览器- 类型:字符串
- 枚举:[“chrome”,“firefox”]
options
:浏览器配置选项- 类型:对象
- 特性:
headless
:以无头模式运行浏览器- 类型:布尔值
arguments
:附加浏览器参数- 类型:字符串数组
例子:
导航
导航至某个 URL。
参数:
url
(必填):导航到的 URL- 类型:字符串
例子:
查找元素
在页面上查找元素。
参数:
by
(必需):定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):定位器策略的值- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
click_element
单击一个元素。
参数:
by
(必需):定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):定位器策略的值- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
发送密钥
将键发送到元素(键入)。
参数:
by
(必需):定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):定位器策略的值- 类型:字符串
text
(必需):输入到元素中的文本- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
获取元素文本
获取元素的文本()。
参数:
by
(必需):定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):定位器策略的值- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
徘徊
移动鼠标悬停在元素上。
参数:
by
(必需):定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):定位器策略的值- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
拖放
将一个元素拖放到另一个元素上。
参数:
by
(必需):源元素的定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):源定位器策略的值- 类型:字符串
targetBy
(必需):目标元素的定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
targetValue
(必需):目标定位器策略的值- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
双击
对元素执行双击。
参数:
by
(必需):定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):定位器策略的值- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
右键单击
对元素执行右键单击(上下文单击)。
参数:
by
(必需):定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):定位器策略的值- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
按键
模拟按下键盘键。
参数:
key
(必需):要按下的键(例如,“Enter”,“Tab”,“a”等)- 类型:字符串
例子:
upload_file
使用文件输入元素上传文件。
参数:
by
(必需):定位器策略- 类型:字符串
- 枚举:[“id”,“css”,“xpath”,“name”,“tag”,“class”]
value
(必需):定位器策略的值- 类型:字符串
filePath
(必需):要上传的文件的绝对路径- 类型:字符串
timeout
:等待元素的最长时间(以毫秒为单位)- 类型:数字
- 默认值:10000
例子:
截屏
捕获当前页面的屏幕截图。
参数:
outputPath
(可选):屏幕截图的保存路径。若未提供,则返回 base64 数据。- 类型:字符串
例子:
关闭会话
关闭当前浏览器会话并清理资源。
**参数:**无必填
例子:
执照
麻省理工学院
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
通过 MCP 使用 Selenium WebDriver 实现浏览器自动化,支持浏览器管理、元素定位以及基本和高级用户交互。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityFacilitates browser automation with custom capabilities and agent-based interactions, integrated through the browser-use library.Last updated -1541PythonMIT License
- AsecurityFlicenseAqualityEnables browser automation using Python scripts, offering operations like taking webpage screenshots, retrieving HTML content, and executing JavaScript.Last updated -418Python
- AsecurityAlicenseAqualityEnables browser automation with Puppeteer, supporting navigation, form interactions, and connection to active Chrome instances for comprehensive web page interaction.Last updated -84708TypeScriptMIT License
- -security-license-qualityA tool that enables automated browser control using Pyppeteer within the MCP framework, allowing navigation, screenshot capture, and element interaction with websites.Last updated -PythonApache 2.0