[HN Gopher] Playwright Tools for MCP
       ___________________________________________________________________
        
       Playwright Tools for MCP
        
       Author : alex_hirner
       Score  : 97 points
       Date   : 2025-03-26 19:07 UTC (3 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | the_arun wrote:
       | Is this for test automation? or for using Playwright as
       | "Operator" in an Agent?
        
         | codybontecou wrote:
         | I think it's to give the LLM control of your browser.
        
           | bdcravens wrote:
           | 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")
        
             | simonw wrote:
             | 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.
        
         | mvdtnz wrote:
         | Click the link and find out.
        
       | mgdev wrote:
       | 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.
        
         | codybontecou wrote:
         | 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?
        
         | maleldil wrote:
         | Claude Code is amazing. Unfortunately, it's also very
         | expensive. How do interactions with MCP servers affect token
         | usage/cost?
        
       | jauntywundrkind wrote:
       | 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)
        
       | mettamage wrote:
       | 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.
        
         | bdcravens wrote:
         | 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.
        
           | paulryanrogers wrote:
           | Does Playwright work with multiple browsers? I get the
           | impression it can work with multiple engines, but they're
           | just custom wrappers and not the full/original browsers.
        
       | adamtaylor_13 wrote:
       | I want an MCP for capybara so LLMs can write my Rails system
       | tests and debug them when they don't work.
        
         | mazacx5volvo240 wrote:
         | Watermarking and synthesizing text for hosts and clients,
         | private RAG over Slack MCP implementations would disperse LLM's
         | to Local Data Souce: A, B, and remote server C.
         | 
         | [1]:https://dlsp2024.ieee-security.org/wagner.pdf
        
       | rahimnathwani wrote:
       | It seems this new tool from Microsoft is a competitor to
       | https://github.com/executeautomation/mcp-playwright
       | 
       | The Microsoft one seems simpler, whereas the other one has more
       | tools.
        
       | atonse wrote:
       | I'm going to see if I can use this in combination with our JIRA
       | MCP to read a bug ticket's "steps to reproduce" to see if it
       | translate those steps to actually reproduce those actions.
       | 
       | I don't understand the hate against MCP. It is truly exciting to
       | see the Cambrian explosion of "connectors" coming out.
       | 
       | This is going to be the "App Store" for models in a way that
       | OpenAI's custom GPTs never was.
        
       | lxe wrote:
       | It uses ariaSnapshot, which is an accessible representation of
       | the DOM used by screen readers and accessibility validation tools
       | as well as playwright testing.
       | 
       | However, even with that, it will quickly exhaust the model
       | context if you navigate to something like Gmail. I just verified
       | this with cursor.
       | 
       | I've been playing around with a much better textual
       | representation of the page that's much more compact:
       | 
       | https://github.com/lxe/chrome-mcp/blob/master/src/runtime-te...
       | 
       | This uses your own chrome session and doesn't require a huge
       | context size.
       | 
       | I might refactor this to use the aria interface available to the
       | CDP, which I wasn't aware of at the time.
        
         | dannyobrien wrote:
         | I agree -- I hacked up a CDP-driven MCP so that Claude can
         | drive your own browser instance, and I think that's more in the
         | spirit of how MCP is supposed to work (where it's driving your
         | tools under supervision, rather than spinning up its own
         | context)
        
       | upcoming-sesame wrote:
       | "code --add-mcp"
       | 
       | Vscode comes with a built in MCP client ?
        
       ___________________________________________________________________
       (page generated 2025-03-26 23:00 UTC)