Skip to content

How to Handle Dynamic Waits in Selenium and Playwright

Practice dynamic waits — waitForSelector, explicit waits, polling, network idle, toast messages, skeleton loaders, and async content in Playwright, Selenium & Cypress.

Intermediate15 min8 scenarios14 test cases

Interactive Scenarios

S01Scenario 1: Delayed Element Appearance
Element not visible
S02Scenario 2: Loading Spinner / Skeleton
Spinner not handled
S03Scenario 3: Toast / Snackbar Message
Toast not captured
S04Scenario 4: Polling Until Condition
0/ 5 — increments every 500 ms
Condition not met
S05Scenario 5: Element Enabled After Delay

Button becomes enabled 3 seconds after arming. Wait for state: 'enabled'.

Button still disabled
S06Scenario 6: Text Changes (Hard)
Status:Idle

Locate via: //div[@data-testid="dw-status-panel"]//span[contains(@class,"status-value")]

Text not asserted
S07Scenario 7: Network-Dependent Content (Medium)
Data not loaded
S08Scenario 8: Race Condition / Flaky Element (Challenge)CHALLENGE

Element appears at a random delay (0.5–3.5 s) and vanishes after 800 ms. Catch it with waitForSelector.

Race not handled