Selenium WebDriver 4

Replace a fixed sleep with an explicit wait

Medium70 pts~25 min
  • Explicit waits
  • Flakiness
Practice app · Order Tracker

Asynchronous UI that appears, changes and disappears on timers — for explicit, implicit and fluent waits.

Test URL
/lab/selenium-replace-a-fixed-sleep-with-an-explicit-wait

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Wait for the loaded order status with an explicit wait instead of sleeping.

Your task

  1. 1Open TEST_URL and click #load-status (the status loads after about 2.5 s).
  2. 2Instead of sleeping, create a WebDriverWait of 10 s and wait for #order-status to be visible.
  3. 3Assert #order-status reads “Shipped”.

Acceptance criteria

  • An explicit wait is used
  • No fixed sleep is used
  • #order-status reads “Shipped”
  • At least 1 assertion passes

Constraints

  • Do not use fixed sleeps (Thread.sleep, time.sleep, Task.Delay, driver.sleep).

Selenium WebDriver 4 · Selenium · Waits & synchronization