← Back to blog

Why Does My Playwright Automation Keep Failing?

Playwright TimeoutError on locators, net::ERR_ABORTED on auth redirects, headless detection, rate limiting, MFA walls, and locator drift after a portal redesign: a diagnostic for each failure, with routing table and the yearly maintenance math per portal.

Published by Alex Klarfeld · August 19, 2026
Browser window beside a stopwatch showing an exclamation mark, illustrating Playwright timeouts

Playwright is the best browser automation framework available, and this page exists because that isn't enough. Auto-waiting, resilient locators, and a first-class trace viewer soften the UI layer's sharp edges, but they cannot change what the UI layer is: a rendering surface that a portal's designers are paid to keep changing. If your Playwright automation keeps failing in production, the causes below cover nearly every case, each opening with the failure as you'd describe it to a chatbot.

For the cross-tool view of the same arc, see the anchor diagnostic.

Error-to-fix routing table

Error / symptomRoot causeShort-term workaroundLong-term alternative
TimeoutError on a locatorSlow portal, dynamic content, or locator driftRaise timeout, wait for network idle, update locatorAPI calls: no locator, no render wait
net::ERR_ABORTEDAuth redirect, session expiry, firewallTrace the redirect chain; re-auth logicIntegration layer that owns sessions
Challenge page / blockedHeadless fingerprint detectedStealth plugins, real browser contexts, proxiesAuthenticated network-layer access
429s / IP blocked after crawlsRate limiting on repeated trafficBackoff, distribute, slow downOne backend call per action instead of N page loads
Login dead-ends at a code promptMFA / SSO added to the portalSession reuse, storage stateService accounts with real MFA handling
Locators break after a deployPortal redesign invalidated the DOMRe-inspect, prefer role-based locatorsRemove the UI dependency entirely

"Playwright TimeoutError: waiting for locator"

The signature Playwright failure. Auto-waiting means Playwright retried until the clock ran out, so the question is why the element never became actionable:

  • The portal is slow. Enterprise portals routinely take 10+ seconds to hydrate. Raise the timeout, and gate on page.waitForLoadState('networkidle') or an explicit response rather than guessing.
  • The content is dynamic. The element appears only after an XHR completes. Wait on the response itself (page.waitForResponse) instead of the pixels it eventually paints. Notice what you just did, though: you found the backend endpoint. The data you're waiting to scrape off the screen arrived in that JSON response.
  • The locator drifted. If the timeout started after a portal deploy and reproduces consistently, the DOM changed. Re-inspect and update.

The first two are operating costs. The third is the recurring one, and it gets its own section below.

"Playwright net::ERR_ABORTED on navigation"

The browser gave up on a navigation mid-flight. In enterprise automation this is rarely a network blip; it's the portal's auth machinery. An SSO redirect hop your script didn't expect, a session cookie that expired mid-flow and bounced you to login, or a corporate proxy or firewall terminating the request. Run with tracing on, look at the redirect chain, and you'll usually find a 302 to an identity provider where your script expected a page.

The workaround is re-authentication logic and session-state management (storageState helps). The pattern to notice: session and auth handling is a standing engineering project inside every serious Playwright deployment, and it's the part that portals change most aggressively.

"Playwright headless detected / Cloudflare challenge"

Cloudflare, DataDome, and friends fingerprint headless Chromium through user-agent mismatches, canvas and WebGL signatures, plugin and font surfaces, and behavioral tells like zero-jitter clicks. The escalation ladder, stealth plugins, headed mode in a virtual display, residential proxies, gets more expensive at each rung and decays as detection vendors update.

The question worth asking before climbing it: is this a site you're scraping cold, or a portal you or your customer hold credentials for? For the second case, which is most enterprise automation, the disguise is solving the wrong problem. The portal's frontend talks to backend endpoints over authenticated HTTP; automation that speaks to those endpoints directly, the way Supergood builds it, doesn't fight the fingerprint check at all. That's the argument of Supergood vs Playwright.

"Rate limited / IP blocked after repeated crawls"

Repeated full-page crawls are loud. Every run downloads the entire page weight, HTML, JS bundles, images, trackers, and fires the portal's telemetry, so traffic-shaped detection kicks in even when fingerprints pass. Backoff and distribution help, but you're mitigating a volume problem you created: to read one number, a browser fetches megabytes. A backend API call moves the request+response payload and nothing else, which is also why it doesn't trip volumetric alarms at normal workloads.

"My Playwright script hits an MFA or SSO wall"

The portal added MFA, or IT moved it behind SSO with conditional access. storageState reuse and long-lived sessions postpone the problem; TOTP plumbing solves it until the policy changes. The full workaround landscape is in handling MFA in Playwright, and its honest conclusion applies here: MFA exists to block unattended credential replay, which is what a script is. The version that doesn't break quarterly is a managed integration with real service accounts, where the MFA challenge goes to an email and phone the integration layer actually owns.

Page layout changes: the failure that keeps coming back

Every failure above is intermittent. This one is periodic. Playwright locators, however well-chosen, reference the portal's DOM, and the DOM is a product surface the portal's team keeps shipping to. A typical enterprise portal redesigns meaningfully 1 to 3 times per year. Each redesign that touches your workflow costs 4 to 16 dev-hours to diagnose, re-inspect, patch, and re-validate.

Playwright's mitigations are genuinely better than the older generation's: getByRole and getByLabel survive cosmetic churn that kills CSS chains, and the trace viewer makes diagnosis fast. Use them. But a structural redesign, a form rebuilt, a flow re-ordered, a table virtualized, breaks role-based locators too, because the roles themselves moved. The maintenance cycle (portal updates → locators break → dev triages → repeat next quarter) is not a tooling deficiency. It's the contract you signed by automating the UI. An API integration signs a different contract, with the backend, and the backend doesn't change when the design system does.

Latency at scale: the cost even when nothing breaks

A healthy Playwright run still pays for a browser: full page load, JavaScript execution, dynamic-content waits. A login-navigate-submit workflow of 30 seconds is typical; its backend equivalent is a handful of API calls completing in about a second.

Monthly runsPlaywright (30s/run)API (~1s/run)
1,000~8.3 hours of browser time~17 minutes
10,000~83 hours~2.8 hours
100,000~833 hours~28 hours

Each session is a full Chromium process holding hundreds of MB of RAM, so those hours convert to memory you rent and concurrency ceilings you engineer around. Hosted sessions floor out around $0.15; a realistic multi-step workflow lands near $1.00 per completed call once retries are counted. The complete cost model is in the true cost of browser automation past 10,000 calls a month.

The yearly maintenance bill, one portal

Assumptions stated, arithmetic only: two redesign breaks at 10 hours each, one auth/SSO change at 8 hours, 1.5 hours a month of babysitting flaky waits and session state. Plus the latency line from the table above at 10,000 runs a month.

Cost linePlaywright (12 months)API integration (12 months)
Redesign breaks20 hrs0 hrs
Auth/SSO changes8 hrsHandled by the integration layer
Babysitting18 hrs~0 hrs
Browser time at 10k runs/mo~1,000 hrs of session time~34 hrs of API time
Total dev time~46 hrs/yr~0 hrs after setup

If the portal has an official API that covers the workflow, use it. When it doesn't, that's the gap Supergood fills: generated, maintained REST and MCP APIs at the network layer the portal's own frontend uses. UI redesigns become non-events, and backend changes are detected and fixed by a maintenance agent rather than your on-call.

Related reading

FAQ

Why does my Playwright script keep throwing TimeoutError? The element never became actionable before the clock ran out: slow portal, dynamic content behind an XHR, or locator drift after a deploy. Raise timeouts and wait on responses for the first two; re-inspect for drift. Repeated drift means the breakage is structural.

What does net::ERR_ABORTED mean? A navigation was abandoned mid-flight, usually an SSO redirect, an expired session bouncing to login, or a proxy killing the request. Trace the redirect chain; the durable fix is an integration layer that owns session management.

Why is my Playwright automation detected as a bot? Headless fingerprints: user-agent mismatches, canvas signatures, behavioral tells. Stealth buys time but decays. For portals you legitimately use, authenticated network-layer access removes the fight entirely.

What do I do when the portal redesigns and my locators break? Update them, preferring role- and text-based locators. Budget 4 to 16 dev-hours per break, 1 to 3 redesigns a year. At that frequency on a workflow that matters, move it off the UI layer.

Is Playwright too slow for high-volume automation? At 10,000 monthly runs a 30-second workflow is ~83 hours of browser time, each session a full Chromium process. The equivalent API call is sub-second with no session ceiling. Past a few thousand runs a month, the latency line is a budget line.

playwrightbrowser automationselector driftautomation maintenancebot detection

Ready to get a real API?