Playwright MCP 安装与配置

提供Playwright MCP的安装、配置及运行环境设置指南,适用于自动化测试和浏览器自动化开发。

  • by binh123440
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 binh123440/playwright_mcp

使用说明

Khởi động dự án tayf

Cài đặt Node runtime, python runtime => latest

  1. Cài node: Node
  2. Cài Playwright MCP:
npm install -g @playwright/mcp 
  1. Config để IDE nhận Playwright MCP: a. Mở VS Code -> Ctrl + Shift + P b. Tìm "MCP: User configuration" c. Paste cái này vào:
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    },
    "my-mcp-playwright": {
			"command": "đường dẫn vào thư mục dự án\\.venv\\Scripts\\python.exe",
			"args":[
				"mcp_server.py"
			],
			"type":"stdio"
	}
  }
}
  1. Cài playwright a. Clone project này về.
git clone 

b. Tạo virtual environment

py -m venv .venv

c. Kích hoạt venv

.venv\Scripts\activate

d. Cài dependencies, này mới là base, ai cài gì thêm thì update file requirements.txt nhé

pip install -r requirements.txt

e. Cài browser để chạy playwright

playwright install