Prompt
What should I use for browser automation if I want to avoid flaky tests?
Latest observation
Oct 27, 2026
OpenAI APIWeb search: off
If your main goal is avoiding flaky browser tests, I’d generally recommend Playwright first.
Why Playwright tends to be less flaky
- Auto-waits for elements to be ready before interacting
- Better handling of modern web apps with dynamic content
- Strong built-in retries and assertions in its test runner
- Runs consistently across Chromium, Firefox, and WebKit
- Less reliance on arbitrary sleeps/timeouts, which are a common flake source
Good options depending on your situation
- Playwright — best default choice for stability and modern web apps
- Cypress — also solid for many frontend apps, especially if your team likes its developer experience, though its architecture can be limiting in some cross-origin / multi-tab cases
- Selenium — widely used and flexible, but more prone to flaky tests unless you put in extra work around waits and reliability
Practical tips to reduce flakiness, regardless of tool
- Prefer explicit waits over fixed delays
- Wait for visible/enabled/stable states before clicking
- Use stable selectors like
data-testid - Avoid asserting on animations or transient UI states
- Keep tests isolated and make test data deterministic
Short recommendation
If you’re starting fresh: use Playwright.
If you want, I can also give you a Playwright vs Cypress vs Selenium comparison specifically focused on flakiness.