Playwright 是一个很好的工具,但它诞生时面对的读者是开发者,不是 AI Agent。用它写爬虫,反爬要自己处理,代理池要自己配,碰上验证码脚本就直接崩溃,多任务并行时 cookie 互相串线也不稀奇。最让人沮丧的是另一种情形:你花了一个下午写好完美的登录流程,过两天网站改了一个 class 名,脚本又挂了。最近在 GitHub 上有一个开源项目 BrowserAct,据原文介绍已有约 1.4K 星标,就是冲着这些痛点来的,而且它以 Skill 的形态发布,装好之后,AI Agent 就能直接操控浏览器。
Playwright is a fine tool, but it was written with developers in mind, not AI agents. Use it for scraping and you handle anti-bot measures yourself, set up your own proxy pool, and watch the script crash the moment a CAPTCHA appears; cookies bleeding between parallel tasks is hardly unusual either. Worse is the other familiar case: you spend an afternoon perfecting a login flow, and two days later the site renames one class and the script breaks again. A recent open-source project on GitHub, BrowserAct, which the source article says has about 1.4K stars, targets exactly these pain points. It ships as a Skill, so once installed, an AI agent can drive the browser directly.
两者的区别,可以用一句话概括:Playwright 是给开发者用的自动化库,你写代码,它执行,你是中间的那个人;BrowserAct 是给 Agent 用的浏览器命令行工具,由 Agent 自己判断页面结构、决定点哪个按钮、处理遇到的异常,你甚至不必写代码。如果打个比方,Playwright 像手动挡,挂挡、踩离合、盯转速都是你的事;BrowserAct 像自动挡,你只说目的地,路线它来规划。当然,比喻不等于结论。自动挡省事,但也意味着你把更多判断交给了 Agent,出了错时,排查的方式也和手写脚本不同。
The difference can be put in one sentence. Playwright is an automation library for developers: you write the code, it executes, and you are the middleman. BrowserAct is a browser command-line tool for agents: the agent judges the page structure, decides which button to click and handles exceptions on its own, and you need not write code at all. An analogy: Playwright is a manual gearbox, where shifting, clutch and watching the revs are all your job; BrowserAct is an automatic, where you name the destination and it plans the route. An analogy is not a verdict, though. An automatic is convenient, but it also hands more judgment to the agent, and when something goes wrong, debugging looks different from fixing a hand-written script.
原文说的第一件 Playwright 做不到的事,是内置的 Stealth 浏览器。它对浏览器指纹做了伪装,Canvas 指纹、WebGL 指纹、字体列表、时区和语言偏好都会随机化。普通的无头浏览器一碰到 Cloudflare 这类防护就容易露馅,而按原文的说法,Stealth 模式能通过绝大多数反爬防火墙。它列出的适用场景有三类:采集带防爬保护的网站,操作需要验证的登录页面,以及处理那些一检测到自动化工具就封号的平台。这里要说明的是,以上都是原文的宣传口径,我没有逐项测试,实际效果因站点和防护策略而异。
The first thing the article says Playwright cannot do is the built-in Stealth browser. It disguises the browser fingerprint: Canvas fingerprint, WebGL fingerprint, font list, time zone and language preference are all randomized. An ordinary headless browser tends to give itself away against protections like Cloudflare, while, in the article’s words, Stealth mode gets past most anti-bot firewalls. It lists three use cases: collecting from sites with anti-scraping protection, operating login pages that need verification, and handling platforms that ban accounts the moment they detect automation tools. A caveat: all of this is the article’s own promotional claim. I have not tested it item by item, and real results vary by site and protection strategy.
第二件是动态代理。它可以按地区自动轮换 IP,每次请求换一个出口地址,避免因为访问频率过高被限流。想看某个地区才显示的内容,指定地区代码即可,不必自己搭代理池,也不必另外购买 IP 服务。原文认为它适合大规模数据采集、绕过地区限制和模拟不同地区用户的行为。需要说明的是,你拿到的这篇文章在这里就断了,开头说有”三件事”,但我只看到了前两件,第三件缺失,所以我没有替它补写任何内容。如果你有完整的原文,把后半部分发给我,我可以补进博客。
The second is dynamic proxying. It rotates IPs automatically by region, switching the exit address on every request so you are not throttled for visiting too often. To see content that only appears in a certain region, you specify a region code, with no need to build your own proxy pool or buy an IP service. The article says it suits large-scale data collection, getting around regional restrictions and simulating users in different regions. One thing to flag: the text you gave me stops here. The opening promises three things, but I saw only two, so I have not written anything to fill the gap. If you have the full original, send me the rest and I can add it to the post.
最后要说一句原文自己也强调的话:网络不是法外之地。采集数据一定要遵守法律法规和行业协议,例如 Robots 协议,并且尊重数据权益,不要逾越红线。指纹伪装和 IP 轮换这类能力,放在合规的数据采集、测试和研究里是效率工具,放在越界的用途上就是麻烦的来源。至于标题里”Playwright 可以卸了”这种说法,我觉得更像一句吸引点击的话。Playwright 在测试自己的网站、写确定性的端到端用例上依然很稳,而 BrowserAct 瞄准的是另一类场景:让 Agent 去面对一个你无法控制、随时会变的外部网页。选哪个,取决于你手里是哪一种活。
Finally, a point the article itself stresses: the internet is not a lawless space. Collect data in line with laws, regulations and industry conventions such as the Robots protocol, and respect data rights; do not cross the line. Fingerprint disguise and IP rotation are efficiency tools in compliant collection, testing and research, and a source of trouble when used beyond those bounds. As for the headline claim that Playwright can be uninstalled, I think it reads more like click bait. Playwright remains solid for testing your own site and writing deterministic end-to-end cases, whereas BrowserAct aims at a different job: sending an agent into an external web page you do not control and that can change at any moment. Which to choose depends on which kind of work is on your desk.