AIGC(生成式AI)试用 39 -- PlayWright MCP

📅2026/7/12 23:57:24 👁️次浏览
AIGC(生成式AI)试用 39 -- PlayWright MCP
MCP模型上下文协议Model Context ProtocolMCP是由Anthropic推出的开源协议旨在实现大语言模型与外部数据源和工具的集成用来在大模型和数据源之间建立安全双向的连接。该协议通过相同的协议同时处理本地资源例如数据库、文件、服务等和远程资源例如Slack或GitHub等API安装playwright 及 浏览器支持pip install playwright playwright install安装playwright MCP server1) 安装nodejs(LTS)版Node.Js中文网 / Node.Js2) 安装 playwright MCP serverLangChain - Changelog | MCP Adapters for LangChain and LangGraph# Microsoft官方发布和维护标准MCP client npm install -g playwright/mcp # 社区开发者executeautomation构建的MCP server适合进阶使用者或自动化测试场景更复杂的项目 # npx playwright/mcp --version Version 0.0.41 npm install -g executeautomation/playwright-mcp-server ## 安装依赖库 mcp langchain-openai langgraph dotenv python-dotenv langchain-core langchain-mcp-adaptersCursor- 安装Cursor 是一款由 AI 驱动的代码编辑器能够理解你的代码库并通过自然语言帮助你更高效地编写代码。下载Cursor用 AI 编码的最佳方式- 添加MCP配置File -- Preferences -- Cursor Settings -- Tools MCP{ mcpServers: { playwright: { command: npx, args: [playwright/mcplatest] } } }- 新建 Agent - New Chat- 创建指令 Prompt请使用Playwright MCP打开百度搜索Playwright-MCP教程将搜索结果截图并保存在C盘。- 执行# Open Baidu homepage await page.goto(https://www.baidu.com); # Search for Playwright-MCP教程 await page.getByRole(textbox, { name: ????????? }).fill(Playwright-MCP教程); # Press Enter await page.keyboard.press(Enter); # Capture results screenshot await page.screenshot({ fullPage: true, path: C:\\Users\\rolei\\AppData\\Local\\Temp\\playwright-mcp-output\\1759732255240\\baidu_playwright_mcp_search.png, scale: css, type: png }); # save to C:\ powershell -NoProfile -ExecutionPolicy Bypass -Command Copy-Item -LiteralPath C:\Users\rolei\AppData\Local\Temp\playwright-mcp-output\1759732255240\baidu_playwright_mcp_search.png -Destination C:\baidu_playwright_mcp_search.png -Force参考1Playwright MCP浏览器自动化详解指南-阿里云开发者社区2Puppeteer MCP 与 Playwright MCP深度对比与选择指南 - 知乎3安装 | Playwright Python 中文网4AIGC生成式AI试用 37 -- 辅助测试 Browser-use, Playwright-CSDN博客