A browser test can be retried; the action it performed is not automatically safe to repeat. If a timeout or browser crash happens after submitting a form, the result may be unknown—not failed. Check authoritative application state before submitting again, and use a stable operation identifier or server-side deduplication where the application supports it.
Why a retry can create a duplicate
A timeout tells you that the automation did not receive confirmation in time. It does not prove the application never received or completed the action. For example, a browser can lose its connection after an order is accepted but before the confirmation page loads. Replaying the submission may create another order unless the application prevents duplicates.
As an Amazon Associate I earn from qualifying purchases.
This is why retry configuration and idempotency solve different problems. A test runner decides whether to run code again after a failure. Idempotency is a property of how an operation behaves when repeated. Configure retries to recover from transient failures, but make consequential application actions safe through state checks or server-side deduplication.
Recommended Free Tools
First decide what is being retried
Identify the retry boundary before changing test settings: a locator action, an individual request, a complete test, or a multi-step workflow. The wider the boundary, the more actions may run again. A retried test might repeat setup, form submission, and cleanup—not just the line where the timeout appeared.
#1 Best Overall
Separate read-only checks from side effects. Reading a page or querying an operation’s status is generally different from submitting an order, creating an account, or charging a payment. After an ambiguous outcome, query authoritative application state or an operation-status endpoint before replaying the side effect.
Reconcile uncertain outcomes before replaying
- Record the logical operation. Give the intended action a stable identifier if your application supports one, and retain it for every attempt to perform that same operation.
- Check the source of truth. Query the application’s authoritative record or status endpoint using that identifier or other reliable transaction details. A missing browser confirmation is not a reliable status check.
- Choose the next action from the result. If the operation completed, continue from the completed state rather than submitting again. If it definitively did not complete, retry according to the application’s rules. If the state remains uncertain, do not blindly replay a high-impact action; use the application’s recovery or support path.
Where available, server-side idempotency keys or deduplication are stronger safeguards than relying on the browser to infer whether a request arrived. The key must stay stable across attempts for one logical operation; generating a new key for every retry can make each attempt look like a separate operation.
Rank #2
HTTP idempotency does not make a browser workflow safe
HTTP semantics provide a useful way to reason about request replay, but they do not guarantee that a multi-step browser workflow is safe to repeat. A workflow can involve several requests, application state changes, and user-visible effects. Even if one request uses an idempotent method, replaying the entire workflow may repeat other actions. Assess the behavior of the specific operation and application, rather than assuming browser-level retries inherit HTTP safety. See RFC 9110, HTTP Semantics.
Configure retries without mistaking them for protection
In Playwright Test, retries are disabled by default. When configured, the runner retries failed tests up to the specified maximum. A test that passes on retry is reported as flaky, and Playwright discards the failed worker and runs the retry in a new worker. That fresh worker does not undo side effects the first attempt may already have caused. See Playwright Test retries.
Use runner retries for transient problems, while ensuring each rerun starts from known conditions. Keep tests independent, make fixtures and setup safe to execute again, and make cleanup tolerant of partially completed work. Playwright exposes retry state so a test can apply retry-specific handling, including clearing server-side state when appropriate. Prefer an explicit reset or unique test data over assumptions that a previous run left nothing behind.
Wait for the condition that matters
Timing races are a common source of flaky browser tests. A fixed sleep may be too short when a page is slow or unnecessarily long when it is fast. Wait for an observable condition—such as a particular status, element state, or operation result—instead. Selenium’s waiting strategies explain the trade-offs and warn that mixing implicit and explicit waits can produce unpredictable timeout behavior.
Playwright web-first assertions re-check a condition until it succeeds or the timeout expires. The documented default assertion timeout is five seconds; choose a different timeout only when the expected behavior warrants it. An assertion that confirms a success state is useful synchronization, but if it times out after a side-effecting action, it still does not establish that the action failed. See Playwright assertions.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Keep evidence from the first attempt
A retry that passes is a flaky-test signal, not proof that the original attempt had no effect. Preserve enough evidence to reconstruct what happened: the operation identifier, relevant application state, and the original attempt’s browser and network activity. Playwright recommends traces for CI failures; its best practices documentation describes trace viewer timelines, DOM snapshots, and network requests. Selenium WebDriver supports local or remote browser control, which can help teams run tests across their chosen infrastructure; see the WebDriver documentation.
Best Value
Choose safeguards by risk and observability
There is no single retry policy for every action. Use the consequences of duplication, the ability to query current state, and the available deduplication mechanism to determine what is safe to repeat.
Quick Recap
| Situation | Before retrying | Safer approach |
|---|---|---|
| Read-only page check or assertion | Determine whether repeating the read is harmless and wait for the relevant condition. | Use condition-based waits or web-first assertions rather than fixed sleeps. |
| State-changing action with queryable status | Check the authoritative state or operation-status endpoint. | Continue from the observed state; replay only if the application establishes that the operation did not complete. |
| Consequential action with a stable key or server deduplication | Confirm the same logical operation identifier will be reused. | Retry with that stable identifier so the server can recognize duplicate attempts. |
| Consequential action with no reliable status check or deduplication | Recognize that the outcome may remain unknown after a lost confirmation. | Do not automatically replay; use an application-specific recovery path and improve observability or deduplication. |
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.




