Selenium WebDriver 4

Write a custom expected condition

Hard120 pts~45 min
  • Custom conditions
  • Explicit waits
Practice app · Order Tracker

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

Test URL
/lab/selenium-write-a-custom-expected-condition

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

Objective

Write your own wait condition that combines two signals no built-in condition covers.

Your task

  1. 1Open TEST_URL.
  2. 2Write a condition (lambda, function or ExpectedCondition class) that is true only when #attribute-target has class “is-ready” and #dynamic-text reads “Ready”.
  3. 3Pass it to an explicit wait.
  4. 4Assert #dynamic-text reads “Ready”.

Acceptance criteria

  • A custom condition is passed to an explicit wait
  • #dynamic-text reads “Ready”
  • 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