(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=43485740

这个Hacker News帖子讨论了Playwright Tools for MCP,这是一个新项目,允许大型语言模型(如Claude)控制网页浏览器。一位用户成功地使用Claude Code来自动验证代码更改。Claude被指示使用Playwright来验证更改,这包括启动开发服务器、导航到更改的页面以及验证更改。如果出现任何意外问题,LLM会自行纠正。 讨论深入探讨了它的潜在用例,一位用户询问了触发该工具的具体提示以及它执行的UI验证类型。它与Puppeteer进行了比较,Playwright被认为是一种进化,提供了类似的API,但具有改进的抽象和多浏览器支持。 对话澄清了Playwright Tools for MCP旨在赋予LLM对浏览器的控制权,允许用户提供自然语言提示(例如,“在eBay上搜索Playstation 5”),而不是显式的选择器,有效地将Playwright用作Agent中的“操作员”。它可以利用Chrome的可访问性树或Claude的视觉来解释页面内容。


原文
Hacker News new | past | comments | ask | show | jobs | submit login
Playwright Tools for MCP (github.com/microsoft)
25 points by alex_hirner 1 hour ago | hide | past | favorite | 9 comments










This is so good. I've been using it with Claude Code with great success.

I just leave an instruction in CLAUDE.md to validate changes with Playwright. It automatically starts a dev server (wrote a little MCP server to do that), navigates to the page with the changes it just made, and validates that its changes worked. If there is anything unexpected, it self-corrects.

It's like working with a really great mid-level engineer.

What a time to be alive.



Interesting use-case. Can you give an example of a prompt you use that triggers this tool? Are you validating UI changes (button color), navigation, or something more complex?


Submitted acouple times, would love to hear more.

Note also, there's a Fetch-MCP which is playwright based, supports batch. Would be interesting to compare. https://github.com/jae-jae/fetch-mcp https://news.ycombinator.com/item?id=43419713 (64 points, 6 days ago, 14 comments)



I don't know playwright, but how is this different than puppeteer?

The issue I'm noticing with puppeteer is that it isn't always successful to immediately get the right javascript to complete a simple task such as accepting a cookie consent banner, for example.



Playwright is a bit of an evolution of Puppeteer. Mostly the same API, extends the API a bit (I tend to prefer its abstractions over Puppeteer), and designed to work with multiple browsers. It came from many of the same developers as Puppeteer.


Is this for test automation? or for using Playwright as "Operator" in an Agent?


I think it's to give the LLM control of your browser.


So instead of specifying explicit selectors, etc, you just use a prompt? (like "Go to eBay.com, search for Playstation 5, and click on the first result that isn't a promoted listing")


Yes, exactly. It defaults to using the Chrome accessibility tree but it can also be run so it uses Claude's vision feature against screenshots instead.






Join us for AI Startup School this June 16-17 in San Francisco!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



Search:
联系我们 contact @ memedata.com