QA Interview
Selenium Waits Scenario Interview Questions in Java (2026)
Practice selenium waits scenario interview questions java candidates face, with precise WebDriverWait, FluentWait, polling, and debugging answers for SDETs.
22 min read | 3,680 words
TL;DR
Strong answers connect each wait to the state the test needs next. In Java, use WebDriverWait for most UI synchronization, FluentWait for specialized polling, and custom ExpectedCondition lambdas for application-specific readiness.
Key Takeaways
- Wait for an observable application state, not an arbitrary number of seconds.
- Keep implicit wait at zero when explicit waits control synchronization.
- Choose presence, visibility, clickability, or a custom condition according to the next operation.
- Locate elements inside retrying conditions when the DOM can replace them.
- Use FluentWait when polling cadence or ignored exceptions genuinely needs customization.
- Treat timeouts as diagnostic evidence and include the awaited state in failure messages.
Selenium waits scenario interview questions java interviewers ask are designed to reveal whether you can synchronize with a changing application, not whether you memorized three wait names. A strong answer identifies the state required by the next action, selects a bounded polling strategy, and explains what evidence a timeout provides.
This guide gives 48 scenario questions with model answers and runnable Java examples. For deeper API practice, compare the focused guides on Selenium ExpectedConditions in Java, FluentWait in Java, and implicit wait pitfalls.
TL;DR
| Situation | Preferred synchronization | Reason |
|---|---|---|
| Element must exist | presenceOfElementLocated |
Returns after DOM insertion |
| User must see it | visibilityOfElementLocated |
Requires displayed state and nonzero size |
| User must click it | elementToBeClickable plus business checks |
Requires visibility and enabled state |
| DOM replaces a node | Locator-based condition or refreshed |
Re-finds the current element |
| Application exposes a ready flag | Custom ExpectedCondition |
Waits for the real domain state |
| Non-WebDriver resource | FluentWait<T> |
Polls any input type |
The governing rule is simple: wait for a fact, cap the wait, and make failure readable. Never use Thread.sleep as the primary synchronization mechanism.
1. Selenium Waits Scenario Interview Questions Java Fundamentals
Q: What problem do Selenium waits solve?
A wait bridges the timing gap between a fast test command and an asynchronously changing page. It repeatedly evaluates a condition until that condition succeeds or a deadline expires. The best condition describes what the next test operation requires, such as visible text or an enabled submit button. It does not guarantee that every hidden application process has finished.
Q: How do implicit, explicit, and fluent waits differ?
An implicit wait changes how long WebDriver retries element lookup across the session. An explicit wait polls a named or custom condition for one scenario. WebDriverWait is a WebDriver-specialized FluentWait<WebDriver>, while FluentWait<T> lets you configure polling and ignored exceptions for any input type. Most maintainable suites use explicit waits with implicit wait set to zero.
Q: Why is Thread.sleep(3000) a weak answer?
Sleep always consumes the full delay, even if the page becomes ready immediately. It also fails when readiness takes longer than the guessed duration. Because it checks no state, its failure says nothing about what remained unready. A bounded explicit wait can return early and names the missing condition.
Q: What does polling mean?
Polling means evaluating the same condition repeatedly during a time budget. A condition may fail with false, return null, or throw an ignored exception before a later attempt succeeds. Polling should be frequent enough to react promptly but not so aggressive that it floods the browser or backend. The default cadence is usually adequate unless the system has a known constraint.
2. Choosing the Correct ExpectedCondition
Q: An element exists in HTML but is hidden. Which condition do you choose?
Use presenceOfElementLocated only if the next operation needs the DOM node without interacting with it. Use visibilityOfElementLocated before reading user-visible content or interacting with the displayed control. Visibility means Selenium considers the element displayed and its dimensions are greater than zero. Presence alone can return a hidden template or pre-rendered panel.
Q: Is elementToBeClickable proof that a click will succeed?
No. The condition checks that an element is visible and enabled. It cannot guarantee that an animation, transparent overlay, sticky header, or last-moment DOM replacement will not intercept the click. If overlays are part of the UI, first wait for their invisibility, then wait for the target to be clickable. A click failure still deserves investigation rather than a blind JavaScript click.
Q: How do you wait for text to change from Processing to Complete?
Wait on the locator with textToBe(locator, "Complete") when the entire rendered text should match. Use textToBePresentInElementLocated when a stable substring is sufficient. A locator-based condition tolerates node replacement better than holding the original WebElement. Assert the final business value after the wait so the test communicates its requirement.
Q: How would you wait for a loading spinner to disappear?
Use invisibilityOfElementLocated(spinner). It succeeds when the matching element is hidden or absent, both of which usually represent completion. Do not first require the spinner to appear unless the product contract guarantees it, because a fast response may skip the visible loading state. Follow the spinner wait with a condition on the result that the user actually needs.
3. WebDriverWait Java Implementation Scenarios
Q: Show a minimal explicit wait that can run.
Use Selenium Manager through a current Selenium dependency, create the driver, and close it in finally. This example waits for the search field on Selenium's own site, types a query, and verifies its value. The condition and the assertion describe separate responsibilities: synchronization and correctness.
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class SearchWaitExample {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
try {
driver.get("https://www.selenium.dev/");
By search = By.cssSelector("button.DocSearch-Button");
WebElement button = new WebDriverWait(driver, Duration.ofSeconds(10))
.until(ExpectedConditions.elementToBeClickable(search));
if (!button.isDisplayed()) throw new AssertionError("Search button is hidden");
System.out.println("Search button ready");
} finally {
driver.quit();
}
}
}
Verify with mvn -q -Dexec.mainClass=SearchWaitExample exec:java; expect Search button ready.
Q: Where should wait durations live?
Put meaningful defaults in one configuration object, then allow rare scenario-specific overrides. A page object can accept a Duration or a configured WebDriverWait rather than embedding 10 seconds in every method. Distinguish ordinary UI readiness from genuinely long operations such as report generation. Centralization makes timeout policy visible without forcing every condition to share one inappropriate deadline.
Q: Should a page object store one WebDriverWait instance?
It can, provided the driver and default timeout share the page object's lifecycle and tests do not mutate that wait. Creating a short-lived wait per action is also cheap and makes exceptional durations explicit. Avoid a globally mutable singleton because parallel tests may share configuration accidentally. The design goal is ownership clarity, not minimizing object construction.
Q: How do you add a useful timeout message?
Use withMessage before until, and describe the expected state plus identifying context. For example, new WebDriverWait(driver, timeout).withMessage("Checkout total did not stabilize for cart 1842") explains the business failure. Preserve Selenium's cause and stack trace rather than catching TimeoutException and throwing a blank assertion. Attach URL, screenshot, and relevant DOM in the test framework's failure hook.
4. Dynamic DOM and Stale Element Scenarios
Q: A React rerender causes StaleElementReferenceException. What do you change?
Stop retaining the old node across the rerender. Put a By locator inside the wait so every poll finds the current element, then perform the action on the returned instance. ExpectedConditions.refreshed can wrap a condition when replacement is expected, but it is not a license to ignore unstable design indefinitely. Confirm that the locator identifies the same logical control after rendering.
Q: Should you add stale element to every wait's ignored exceptions?
No. Broadly ignoring staleness can hide a loop where the page continuously replaces the node. Ignore it only around a known transient replacement, with a short deadline and a condition that proves eventual stability. Other operations should surface staleness because it may reveal incorrect element caching or navigation. Scope exception tolerance to the behavior you understand.
Q: How do you wait for a table row created after an API response?
Locate rows on every poll and inspect their cells for the unique business key. Return the matching row, not merely true, so the caller acts on the exact element that satisfied the condition. This avoids a second lookup race after the wait. If pagination or virtualization is involved, include the visible page or scroll state in the condition.
By rows = By.cssSelector("table tbody tr");
WebElement orderRow = new WebDriverWait(driver, Duration.ofSeconds(15)).until(d ->
d.findElements(rows).stream()
.filter(row -> row.getText().contains("ORD-1042"))
.findFirst()
.orElse(null));
if (!orderRow.getText().contains("Paid")) throw new AssertionError(orderRow.getText());
Verify by running the test against a fixture that inserts ORD-1042; the returned row must include Paid.
Q: Can findElements help custom waits?
Yes. Unlike findElement, it returns an empty list when no match exists, so absence can be an ordinary polling state rather than an exception. It works well for waiting on counts, filtered rows, and disappearance. Still guard against an invalid selector, because configuration errors should fail immediately rather than be treated as timing.
5. AJAX, Fetch, and Page Readiness
Q: Is document.readyState == complete enough for a single-page application?
No. It means the initial document and dependent resources reached browser completion, not that later fetch calls or framework rendering ended. An SPA may show a shell while data is still loading. Wait for a user-observable state such as a populated account name, finished progress indicator, or enabled action. Use ready state only when document navigation itself is the relevant boundary.
Q: How do you wait for an AJAX call without jQuery?
Prefer the UI consequence of the request because it matches what a user can observe. Selenium does not expose a universal ajaxComplete condition, and modern applications may use fetch, GraphQL, WebSockets, or background polling. If the response itself is the contract, use Selenium BiDi or an API client with an explicit event strategy, as discussed in waiting for an API response. Do not inject a fictitious jQuery counter into an application that does not use jQuery.
Q: The URL changes before content is ready. What should the wait do?
Treat URL change and page readiness as two conditions. First wait with urlContains or urlToBe, then wait for a unique element or heading on the destination. A route transition can update history before async content resolves. Separating the checks makes failures identify navigation versus rendering.
Q: How would you synchronize with an autosave indicator?
Trigger the edit, then wait for a state transition that proves the new save cycle, such as Saving followed by Saved, when the product reliably renders both. If Saving is too brief, capture a version, timestamp, or changed status attribute that distinguishes this save from an old Saved label. Finally reload or query the persisted value when data durability is the requirement. Waiting on a permanently visible Saved element could pass before the edit is stored.
6. Frames, Windows, Alerts, and Shadow DOM
Q: How do you wait for an iframe and switch safely?
Use frameToBeAvailableAndSwitchToIt with a stable locator. It waits for availability and changes the driver's context as one operation. Use driver.switchTo().defaultContent() in cleanup or before addressing the top document. A present iframe element does not prove its browsing context is ready for switching.
Q: What condition handles a new tab?
Capture the original window handles, trigger the action, then wait until the handle set grows. Select the new handle by set difference and switch to it. numberOfWindowsToBe(2) is concise when exactly two windows are guaranteed. Always close the child and restore the original handle so later tests inherit a valid context.
Q: How do you wait for a JavaScript alert?
Use alertIsPresent, which returns the Alert object when switching succeeds. Read and assert its text before accepting or dismissing it. Do not poll the DOM because modal browser alerts are outside the document tree. A timeout should report which user action was expected to open the alert.
Q: Does Selenium automatically wait through shadow roots?
No universal wait crosses an arbitrary chain of custom-element upgrades and nested shadow roots. Wait for the host, retrieve its shadow root, then locate the inner element in a custom condition that tolerates only the expected not-yet-attached state. Reacquire hosts if the component can rerender. The nested shadow roots Java tutorial covers the traversal details.
7. FluentWait and Custom Condition Questions
Q: When is FluentWait better than WebDriverWait?
Use FluentWait<T> when the polled subject is not WebDriver or when specialized configuration makes the intent clearer. Examples include polling an API client, file path, or domain service. For browser conditions, WebDriverWait already supplies WebDriver-specific defaults and supports polling customization. Choosing FluentWait merely to sound advanced adds no value.
Q: Show a custom condition for an attribute that stabilizes.
Return a useful value only after two consecutive polls observe the same nonblank attribute. Consecutive agreement prevents acting on an intermediate value during animation. Keep mutable observation state local to the condition instance, not global across tests.
import java.time.Duration;
import java.util.concurrent.atomic.AtomicReference;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.WebDriverWait;
By total = By.id("cart-total");
AtomicReference<String> previous = new AtomicReference<>();
String stableTotal = new WebDriverWait(driver, Duration.ofSeconds(8))
.pollingEvery(Duration.ofMillis(250))
.until(d -> {
String current = d.findElement(total).getText().trim();
String old = previous.getAndSet(current);
return !current.isBlank() && current.equals(old) ? current : null;
});
System.out.println("Stable total: " + stableTotal);
Verify by changing the fixture total twice; output must show only the final repeated value.
Q: Which exceptions should FluentWait ignore?
Ignore only exceptions that mean the desired state is not ready yet. NoSuchElementException is reasonable while waiting for insertion, and scoped staleness may be reasonable during replacement. Do not ignore assertion failures, invalid selectors, session loss, or broad RuntimeException, because retries cannot repair those defects. An ignored exception policy documents expected transience.
Q: How do you choose a polling interval?
Start with the library default. Increase it when each poll is expensive or the upstream system changes slowly; decrease it only when reaction latency matters and the application can tolerate the traffic. The interval must remain comfortably shorter than the timeout so several meaningful attempts occur. Avoid claiming one magic millisecond value fits every architecture.
8. Timeout and Exception Diagnosis
Q: What does TimeoutException actually tell you?
It says the condition never returned a successful value within the configured budget. It does not by itself prove the application is slow, because the locator, window context, condition, test data, or prior action could be wrong. Inspect the final cause, message, URL, screenshot, and relevant HTML. Reproduce with timestamps around the state transition before increasing the limit.
Q: A test passes locally but times out in CI. What do you investigate first?
Compare browser version, viewport, CPU contention, network routes, test data, and parallel load. Preserve CI artifacts to see whether a responsive layout changed the locator or a consent banner covered the target. Measure the actual readiness distribution instead of multiplying all timeouts. A larger bound may be justified after the missing state and environmental difference are known.
Q: Should you retry the whole test after a wait timeout?
Not automatically. A test retry can classify flakiness, but it can also conceal a deterministic product defect and double execution time. Record the first attempt's artifacts and retry only under an explicit suite policy. Fix the condition, data isolation, or application race revealed by repeated evidence.
Q: How do you distinguish a slow application from a wrong locator?
Check whether the expected element eventually appears in captured DOM and whether the locator matches it at failure time. Run the locator in the browser against the same state, including iframe and shadow context. Application telemetry can show whether the response completed. A locator that can never match deserves immediate correction, while a valid late transition supports performance investigation.
9. Mixing Waits and Framework Design
Q: Why can mixing implicit and explicit waits be confusing?
An explicit condition may call element lookup repeatedly, and each lookup can consume the implicit wait before the explicit poll continues. The observed duration can therefore exceed what readers infer from the explicit timeout. Set implicit wait to zero and express synchronization at the scenario boundary. This produces more predictable timing and clearer ownership.
Q: Where should waits sit in a page object?
Put synchronization next to the action whose precondition it protects. A CheckoutPage.placeOrder() method can wait for the button's real readiness, click, and return the confirmation page. Keep business assertions in the test unless the page method's contract includes a transition. Do not expose raw sleeps or force callers to understand private DOM animations.
Q: Is a generic waitForPageToLoad() helper good design?
Usually not, because different pages and actions have different definitions of ready. A generic helper tends to check only document ready state or a spinner, neither of which proves the required feature is usable. Prefer names such as waitForResultsCount or waitUntilCheckoutEnabled. Specific helpers reveal intent and produce diagnostic messages.
Q: How should parallel tests manage waits?
Each test thread must own its WebDriver, page objects, and wait configuration. Never share a mutable driver or wait across threads. Read immutable timeout values from common configuration, then construct thread-confined objects. If CI saturation slows every test, manage concurrency and capacity rather than compensating with shared synchronization state.
10. Advanced Selenium Waits Scenario Interview Questions Java
Q: How do you wait for an element count to become exactly five?
Use numberOfElementsToBe(locator, 5) when exactly five is the contract. Use numberOfElementsToBeMoreThan when additional entries are allowed. After synchronization, assert the business-specific contents rather than only the count. Exact-count waits can miss a state that races from four to six, so choose equality intentionally.
Q: How do you wait until an element is removed?
Use stalenessOf(oldElement) when you deliberately captured the node and require that exact node to detach. Use invisibilityOfElementLocated when hidden or absent both satisfy the user-facing outcome. If another matching element can replace it, staleness alone says nothing about the replacement. Match the condition to identity versus visibility semantics.
Q: Can JavaScriptExecutor be used in a wait?
Yes, when the application exposes a trustworthy browser-side state that WebDriver cannot express cleanly. A lambda can execute a script and return Boolean.TRUE after a documented flag changes. Avoid generic jQuery or framework-internal probes that couple tests to implementation and may disappear. Prefer accessible UI state whenever it represents the same contract.
Q: How would you wait for CSS animation completion?
First ask whether the next action can wait on a stable user state, such as an overlay becoming hidden. If animation itself is the contract, observe a documented class, computed property, or transitionend-backed application flag. Waiting a hardcoded animation duration is fragile when reduced-motion settings or device speed changes behavior. Verify that the target is unobstructed before interacting.
11. Real Interview Debugging Scenarios
Q: A clickable wait passes, but ElementClickInterceptedException follows. What is your answer?
Capture the screenshot and identify the intercepting element from the exception. Wait for that overlay, toast, or animation layer to become invisible, then reacquire and click the target. Scrolling or JavaScript clicking should not be the first response because they may bypass a real usability defect. If a sticky header overlaps after scroll, align the element or fix the application layout.
Q: A presence wait passes, but getText() returns empty. Why?
Presence only proves a matching node exists. Text may be inserted later, the node may be hidden, or the visible label may live in a descendant or attribute. Wait for visibility and the expected text condition, then inspect accessible semantics if the UI is icon-based. Do not convert an unknown rendering state into a sleep.
Q: A spinner disappears, yet results are still old. How do you fix the test?
The spinner is an indirect signal and may disappear before the new model commits to the DOM. Capture a distinguishing value from before the action, then wait until the results contain the requested query, version, or record identifier. This guards against passing on cached content. Assert the new dataset after the condition returns.
Q: The first matching locator is hidden and the second is visible. What happens?
A condition built around a single-element lookup may repeatedly inspect the hidden first match. Improve the locator so it uniquely represents the active component, or write a condition that filters findElements for displayed candidates. Positional selectors are brittle if responsive layouts reorder copies. Stable attributes and scoped containers make the intended element explicit.
12. How Interviewers Grade Your Answers
Interviewers reward causal reasoning: name the changing state, the next action's precondition, the selected API, and the evidence collected on timeout. They expect exact distinctions between presence, visibility, enabled state, and click success. Senior candidates also discuss locator freshness, exception scope, parallel ownership, and why an indirect spinner may be weaker than a business result.
Q: What makes a wait answer senior-level?
A senior answer treats synchronization as an observable contract rather than a timeout number. It anticipates DOM replacement, keeps ignored exceptions narrow, and designs diagnostics before failure occurs. It also distinguishes product latency from test defects using artifacts and telemetry. Finally, it places the wait in a reusable boundary without hiding assertions or sharing mutable state.
Q: What should you say before writing code on a whiteboard?
State the required outcome and clarify whether absence, invisibility, or replacement counts as success. Ask whether the application uses frames, shadow DOM, virtualization, or route transitions. Then choose a locator and deadline based on that contract. This short analysis prevents code that solves a different timing problem.
Q: How should you explain timeout values?
Call them maximum budgets, not guaranteed delays. Explain that a successful wait returns as soon as its condition succeeds. Derive longer budgets from a known operation or service objective, and keep ordinary interactions shorter. Avoid fabricated performance claims when no measurement exists.
13. Common Mistakes
- Combining a long implicit wait with explicit waits, which obscures actual elapsed time.
- Waiting for presence before clicking a control that is still hidden or disabled.
- Caching a
WebElementacross navigation, refresh, or component rerender. - Ignoring every exception, including invalid selectors and lost sessions.
- Treating a spinner as stronger evidence than the requested result.
- Increasing timeouts without capturing screenshots, DOM, URL, and the last exception.
- Replacing normal clicks with JavaScript clicks before diagnosing overlays.
- Sharing WebDriver or mutable wait objects between parallel test threads.
Q: What is the most damaging synchronization habit?
Waiting without defining success is worse than choosing the wrong duration. It creates helpers that pass while the application is unusable and fail without useful evidence. Replace vague readiness checks with conditions tied to the next business action. Review every timeout as a missing observable fact.
Q: What practical exercise should a candidate do next?
Build a small page that inserts, replaces, hides, and overlays elements at different times. Implement one locator-based wait for each transition and force a failure to inspect diagnostics. Practice additional scenarios at QA automation practice, then upload a resume aligned to these skills in the resume dashboard. Revisit Selenium interview questions for broader preparation.
Conclusion
The best selenium waits scenario interview questions java answers begin with the state required by the user journey. Use explicit, locator-based conditions for most browser work, reserve FluentWait customization for a demonstrated need, and let timeouts expose evidence rather than hiding them with sleeps or broad retries.
Practice explaining not only which API you chose, but why presence, visibility, clickability, staleness, or a custom domain condition matches the scenario. That reasoning is what turns memorized Selenium syntax into reliable automation engineering.
Interview Questions and Answers
Why do you prefer explicit waits over Thread.sleep?
An explicit wait polls an observable state and returns as soon as it succeeds. Thread.sleep always spends its full duration and provides no state evidence. A timeout from a named condition is also more diagnostic.
What is the difference between presence and visibility?
Presence means a matching node exists in the DOM. Visibility additionally requires Selenium to consider it displayed with nonzero dimensions. I choose according to whether the next operation needs only the node or a user-visible control.
How do you wait through a React rerender?
I avoid caching the old WebElement and use a locator inside the polling condition. Each attempt then resolves the current node. I scope stale-element tolerance only to the known replacement window.
Why is mixing implicit and explicit waits risky?
Element lookup inside an explicit poll can itself consume the implicit timeout. That makes total elapsed time difficult to predict. I normally set implicit wait to zero and use explicit conditions at action boundaries.
How do you choose an ExpectedCondition?
I identify the state the next operation requires. Presence suits DOM inspection, visibility suits rendered content, and clickability covers visible plus enabled. For business states such as a stable total, I write a focused custom condition.
When would you use FluentWait directly?
I use it when polling a non-WebDriver subject or when explicit polling and ignored-exception configuration expresses a special policy. WebDriverWait already covers ordinary browser conditions. The choice should follow a need, not API novelty.
How do you diagnose a TimeoutException?
I inspect the last cause, screenshot, DOM, URL, window or frame context, and application telemetry. The timeout only says the condition did not succeed. Those artifacts reveal whether the application was late or the test asked the wrong question.
How do you wait for AJAX in a modern app?
I wait for the UI consequence, such as a new record identifier or enabled action. Modern apps may use fetch, GraphQL, or WebSockets, so a generic jQuery counter is unreliable. If the network event is itself the requirement, I use an appropriate BiDi or API strategy.
Should all waits ignore StaleElementReferenceException?
No. Global suppression can hide continuous replacement or incorrect element caching. I ignore staleness only around a documented transient rerender and require a final stable state.
How do you make a custom wait maintainable?
I give it a domain-specific name, return the useful value, and include context in its timeout message. It ignores only expected transient failures. Its condition remains side-effect-light so repeated polling is safe.
Why can a spinner wait produce a false pass?
A spinner is an indirect signal and may vanish while old or incomplete results remain. I follow it with a condition on the requested data, preferably a unique value that differs from the prior state. The final assertion then verifies the business outcome.
How do waits work in parallel execution?
Each thread owns its driver, page objects, and wait instances. Immutable duration configuration may be shared, but mutable browser state may not. If load causes widespread slowness, I tune capacity or concurrency using measurements.
Frequently Asked Questions
What is the best wait in Selenium Java?
WebDriverWait is the best default for scenario-specific browser synchronization. Select an ExpectedCondition that represents the state required by the next action.
Should implicit wait and explicit wait be used together?
Usually no. Implicit wait affects element lookups inside explicit polling and can make elapsed time surprising, so keep it at zero when explicit waits define synchronization.
What is the difference between WebDriverWait and FluentWait?
WebDriverWait extends FluentWait for WebDriver and provides browser-oriented defaults. FluentWait is useful when polling another type or when specialized polling and exception configuration improves clarity.
Why does elementToBeClickable still allow click interception?
It checks visibility and enabled state, not every overlapping layer or DOM change. Wait separately for known overlays to disappear and diagnose the intercepting element.
How do you handle stale elements in a Selenium wait?
Re-find the element through a locator during each poll. Ignore staleness only in a narrow condition where temporary replacement is expected.
How long should a Selenium explicit wait be?
Use a measured maximum budget appropriate to the operation. Keep routine UI waits bounded and give genuinely long backend jobs a separate, named timeout.
Is document.readyState complete enough for SPA tests?
No. It covers document loading, while SPA data and rendering may continue later, so wait for a user-visible destination state.
How can Selenium timeout failures be easier to debug?
Add a condition-specific message and capture the URL, screenshot, relevant DOM, and last exception. Those artifacts distinguish latency, locator, context, and data problems.
Related Guides
- How to Use Selenium DevTools in Selenium 4 in Java (2026)
- Pact Contract Testing Interview Questions in Java (2026)
- Selenium BiDi Coding Interview Questions in Python (2026)
- Selenium Framework Design Interview Questions Java (2026)
- Selenium Java Debugging Interview Questions (2026)
- Database Testing Scenario Interview Questions for Senior QA (2026)