1 您需要先安装 Node.js,因为 npm 是 Node.js 的包管理工具,默认会随 Node.js 一起安装。

示例:验证是否已安装

node -v # 检查 Node.js 版本

npm -v # 检查 npm 版本

2 # 安装 Playwright MCP 服务器

npx @playwright/mcp@latest

3 # 安装浏览器驱动

npx playwright install

4  在VS中安装playwright MCP插件,cline或copilot

5 直接描述测试场景

测试场景:

用户登录

步骤:

1. 打开 https://demo.example.com/login

2. 输入用户名 test@example.com

3. 输入密码 123456

4. 点击登录按钮

5. 验证跳转到仪表盘,显示“欢迎回来”

6. 全程截图,失败时录屏

Logo

欢迎加入DeepSeek 技术社区。在这里,你可以找到志同道合的朋友,共同探索AI技术的奥秘。

更多推荐