Selenium WebDriver 4

Diagnose and fix a race condition

Hard120 pts~45 min
  • Race conditions
  • Flakiness
Practice app · Order Tracker

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

Test URL
/lab/selenium-diagnose-and-fix-a-race-condition

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

Objective

Fix a test that asserts a result immediately after clicking, before the app has produced it.

Your task

  1. 1Open TEST_URL and click #race-button.
  2. 2Notice that asserting #race-result immediately fails — the result appears about 1.2 s later.
  3. 3Wait for #race-result explicitly.
  4. 4Assert it contains “ETA updated”.

Acceptance criteria

  • An explicit wait is used
  • No fixed sleep is used
  • #race-result contains “ETA updated”
  • 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