BrowserAct’s stealth browser passed a bot-detection check that flagged Playwright’s default headless run as a bot, even though both scripts completed the same login flow. The contrast shows why an agent-based approach can be safer when you need to interact with sites that guard against automation.

Why the test matters

Automation tools power testing, data collection, and account management. Most developers reach for selector-driven frameworks like Playwright because they let you write precise instructions—“click the button with this CSS selector”—and verify outcomes quickly. Modern sites, however, embed scripts that sniff for headless browsers: a generic user-agent string, the webdriver property, or missing human-like interaction patterns. When those signals appear, the site blocks the request or serves a CAPTCHA, effectively neutering the script.

Agent browsers try to mimic a human user without relying on pre-written selectors. They treat a page as a collection of actionable elements, picking one by its position in an internal index rather than by a CSS path. The test compared the two approaches on a JavaScript-rendered login page and a site that deliberately checks for bots.

The experiment

I wrote two scripts that performed the same steps: load the login page, enter credentials, submit, and reach the inventory page. One script used Playwright in its default headless mode; the other used BrowserAct’s stealth browser, which masks the fingerprints that trigger bot detection.

Both scripts authenticated against a sandbox site, proving the core login flow works regardless of the tool. The divergence appeared when the scripts visited a dedicated bot-detection page that returns a JSON flag isBot. Playwright reported isBot: true, tripping five separate detection checks. BrowserAct returned isBot: false, indicating the page treated it as a regular human visitor.

I traced the difference to two technical details. Playwright’s default configuration sends a generic user-agent string and leaves the webdriver flag exposed—both easy for a detection script to spot. BrowserAct’s stealth mode rewrites the user-agent, removes the webdriver property, and aligns its fingerprint with that of a typical desktop browser.

How the tools differ under the hood

Aspect Playwright (default) BrowserAct (stealth)
Interaction model Selector-driven, deterministic Agent-driven, index-based
Need for pre-written selectors Mandatory; script must know the exact DOM structure Not required; agent discovers actionable elements at runtime
Handling of layout changes Breaks if selectors shift Continues as long as element positions stay within the indexed list
Exposure to bot checks User-agent and webdriver left untouched Fingerprints deliberately masked
Typical use case Internal sites, stable UI, rapid test cycles Public sites with anti-automation measures, constantly changing pages

The table captures the practical trade-offs. Playwright shines when you control the site and can guarantee stable element identifiers. An agent browser shines when you cannot predict the page structure or when the site actively tries to block scripts.

Who benefits and who is at risk

Developers building regression suites for their own applications can keep costs low and test speed high by staying with Playwright. Its deterministic nature points failures directly to code regressions, and the lack of extra stealth layers reduces complexity.

Conversely, teams that scrape data, automate account creation, or monitor competitor sites often hit roadblocks because target pages change frequently or embed aggressive bot detection. In those scenarios, an agent browser avoids the immediate “you are a bot” dead-end and continues to the data they need.

The hidden costs of “it worked”

I warn that a successful exit code does not guarantee the automation behaved as intended. In the Playwright run, the script finished without throwing an error, yet the page still considered the request a bot. The result was a hidden failure: downstream steps that rely on human-only content never received the expected data.

要发现此类静默失败,请在每次运行后检查页面证据:滚动位置、文档高度和网络调用。如果 DOM 看起来与人类所见的不同,或者网络流量包含指向验证挑战的意外重定向,那么自动化很可能未能实现其目标。

核心结论

如果你是网站的所有者,并且可以基于稳定的选择器编写脚本,那么 Playwright 仍然是务实的选择——快速、廉价,且易于集成到 CI 流水线中。当你面临未知的布局、激进的反自动化防御或频繁的 UI 变动时,像 BrowserAct 这样的智能体浏览器提供了一条更具韧性的路径。不要盲目相信运行成功;请验证页面的行为是否与人类一致,并选择与目标网站风险特征相匹配的工具。