
Playwright × AI — codegen, MCP, Self-Healing Selectors
↻ 2026-10-02 Updated I corrected how this post described the snapshot an AI agent receives. The snapshots I originally showed were Playwright’s default aria snapshots, the kind tests use, but what Playwright MCP actually hands the model is a snapshot taken with mode: 'ai', and it looks different. Retaking them showed that even the div button survives as a nameless generic that can be clicked by its number (ref). The result was the same on 1.61, the version the practice repo used, so this wasn’t a version change — I got it wrong from the start. So I’ve withdrawn the claim that “a screen a screen-reader user can’t use, an AI agent can’t use either,” and rewritten the section around the finding that each agent tool receives a different tree. The conclusion — get role and name right — stands. This is Part 20 of the “Frontend Testing, Done Right” series. Browse the full series · Glossary ...