trae使用playwright MCP方法流程
trae使用playwright MCP方法流程
1. 安装trae
2. 安装node.js
3. python
4. 安装playwright
pip install playwright为playwright安装浏览器:
python -m playwright install
5. 安装uv
pip install uv
6. 添加playwright MCP
方式1:从市场添加
打开trae IDE右上角,点击“AI功能管理” -> MCP -> +添加 -> 从市场添加 -> 搜索playwright添加
此方式会自动配置:
{"mcpServers": {"Playwright": {"command": "npx","args": ["-y","@executeautomation/playwright-mcp-server"],"env": {},"disabled": true}}
}
此方式使用的是trae环境中MCP
方式2:手动添加
打开trae IDE右上角,点击“AI功能管理” -> MCP -> +添加 -> 手动添加 -> 手动配置:
{"mcpServers": {"playwright-browser-MCP": {"command": "npx","args": ["@playwright/mcp@latest","--extension"]}}
}
此方式使用的是浏览器扩展中的MCP,需要额外下载浏览器拓展:
下载方法:
前往https://github.com/microsoft/playwright-mcp/releases 下载最新版本的playwright MCP扩展。
下载解压后在浏览器中加载扩展(开发者模式)