Chapter 3: Handling Waits and Synchronization
This is the #1 interview question on waits. When both implicit wait (e.g. 10s) and explicit wait (e.g. 15s) are active, explicit wait calls findElement() during each poll. If the element is not found, implicit wait forces a 10-second pause before returning to explicit wait! A 15-second wait can freeze for over 200 seconds.
Presence only means the HTML tag exists in the DOM tree. It could have opacity: 0, display: none, or be disabled. If you call .click() after presence check, you get ElementNotInteractableException. Always use elementToBeClickable for click targets.
Never write new WebDriverWait(driver, Duration.ofSeconds(10)) scattered across 50 classes. Centralize timeouts in a TimeoutConfig class so timeout policies can be tuned across the entire test suite in one place.
Key Point: Never mix implicit and explicit waits, always use elementToBeClickable before clicks, and centralize timeout constants.