Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsMost flaky automated tests are not fixed by adding retries. They usually expose uncontrolled state, timing assumptions, races, or dependencies between tests. Diagnose the failure first, then make setup deterministic, wait for meaningful conditions, isolate parallel work, and reserve browser tests for checks that need a real browser.
Start by choosing the right level of test
A browser test is justified when the behavior being checked depends on a real browser—for example, a user-visible flow whose correctness depends on browser interaction. For other behavior, a lower-level test may answer the question with less runtime and infrastructure. Selenium advises teams to ask whether a real browser is necessary; its overview notes that browser tests require infrastructure and can be expensive.
As an Amazon Associate I earn from qualifying purchases.
Use these questions to choose a test boundary:
- Does the check require real browser behavior? If not, consider testing it at a lower level.
- What fidelity is necessary? Keep browser coverage for user-visible behavior where browser fidelity matters; use faster checks for behavior they can verify adequately.
- Can the test be set up and diagnosed independently? Account for the setup, isolation, and evidence needed to reproduce a failure.
- What is the runtime and infrastructure cost? A focused browser suite can complement lower-level checks instead of putting every requirement through an end-to-end flow.
Selenium’s test automation overview describes a test as data setup, a discrete action, and result evaluation, and recommends keeping those steps short. It also states: “Browser automation has the reputation of being ‘flaky’, but in reality, that is because users frequently demand too much of it.” The point is not to avoid browser tests; it is to ask them to verify work suited to that level. Selenium: Test Practices and Guidelines
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Diagnose flaky failures before changing the test
An intermittent failure means the same test does not produce the same result every time. That is a symptom, not a root cause. Google’s testing guidance identifies execution-time dependencies, assumptions about asynchronous event order, waits without timeouts, and races between a test and the application as common causes.
Look for evidence in the failure
- Does the test fail more often under load or in CI than on a developer machine? Check timing assumptions and resource pressure.
- Does it pass when run alone but fail in a suite? Investigate shared state and execution order.
- Does a retry pass? Treat that as evidence of intermittency, not proof that the problem is fixed.
- Does the failure happen around an asynchronous action? Check whether the test waits for the relevant outcome or merely assumes the action has finished.
Preserve useful failure context, including the state and timing around the failed action, so the cause can be reproduced and investigated. Avoid using a larger retry count or a longer delay as a substitute for that diagnosis. Google Testing Blog: Flakiness
Replace timing guesses with condition-based waits
A fixed sleep assumes that an operation will finish within an arbitrary interval. If the interval is too short, the test remains flaky; if it is longer than necessary, every run is slower. Google advises against arbitrary delays as a general fix. Instead, wait for an observable condition that signals the next action is safe, and give that wait an explicit timeout.
- Identify the condition that must be true before the next step—for example, the expected element or result is available.
- Wait for that condition using the framework’s condition-based waiting mechanism, with a timeout.
- If the timeout expires, inspect the failure evidence and determine whether the application was slow, the condition was wrong, or the action did not complete.
- Make test setup and application state predictable so the condition has a fair chance to become true.
A timeout puts a bound on waiting; it does not itself resolve a race. A test that waits for the wrong signal can still fail, and a test that has an implicit timing dependency can remain brittle even with a longer timeout. Google Testing Blog: Flakiness
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallRemove hidden dependencies between tests
A test is order-dependent when it assumes another test has created, changed, or preserved state for it. Such tests may pass in one sequence and fail when reordered, run alone, or run in parallel. Selenium cautions against relying on a particular execution order, and pytest notes that leftover state can cause failures when tests run concurrently.
Make prerequisites explicit
- Set up the data and conditions a test needs within that test or a deliberate fixture.
- Clean up state where appropriate, while avoiding cleanup that removes data another concurrent test still needs.
- Give records that may be modified concurrently unique identifiers.
- Keep each test focused on its own setup, action, and result rather than relying on side effects from earlier tests.
Fixtures can make setup reusable, but a shared fixture is not automatically safe: its scope and mutable state still need to match how the tests execute. Selenium: Test Practices and Guidelines · pytest: Flaky tests
Make parallel execution safe before scaling it up
Parallelism can shorten feedback time, but it also makes collisions in data, files, and other shared resources more likely. Playwright runs test files in parallel by default. Its workers run in separate processes, but that does not isolate state outside those processes: tests can still collide through a shared backend record or output file.
Rank #4
Increase concurrency deliberately
- Identify state that tests share outside the worker process, including backend data and generated output.
- Give concurrently modified backend records unique identifiers and keep output files isolated.
- Use worker-scoped data when sharing is intentional and safe.
- Set worker limits or shard execution to fit the available CI resources and the capacity of external dependencies.
- Increase concurrency gradually and investigate whether new failures come from test coupling, resource pressure, or external-service limits.
There is no universally correct worker count in the cited guidance. Balance the feedback speed you need against isolation, CI capacity, and the limits of services your tests use. Playwright: Parallelism and sharding
Use retries as a signal, not a repair
Playwright supports retries for intermittent failures and starts a fresh worker after a test fails. A pass on retry may help reveal that a failure is intermittent, but it does not identify or remove the cause. Track which tests fail and pass on retry, then investigate their timing, state, order, and environment assumptions rather than treating retries as a permanent remedy. Playwright: Retries · Google Testing Blog: Flakiness
Best Value
Or skip the browser setup
For capturing a page screenshot as part of a workflow, ScreenshotNeo offers a one-call API:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for parameters and response details. ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides screenshot tools for AI agents, including Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. These are screenshot-capture capabilities, not a replacement for a test suite that verifies application behavior.
Learn about ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Frequently Asked Questions
Why does a test pass locally but fail in CI?
CI may change execution timing, resource load, or test order. Use the failure pattern and surrounding state to distinguish timing assumptions from shared-state or environment issues.
How many parallel workers should I use?
There is no universally correct number. Choose a limit that fits your CI resources and external dependencies, then increase it only while keeping test data and outputs isolated.
Should I remove every browser test?
No. Keep browser tests for behavior that genuinely requires a real browser, and use lower-level tests for checks they can verify adequately.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




