Selenium WebDriver 4

Wait for an attribute to change

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

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

Test URL
/lab/selenium-wait-for-an-attribute-to-change

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

Objective

Wait for a data attribute to switch state.

Your task

  1. 1Open TEST_URL — #attribute-target has data-state “loading”.
  2. 2Wait until its data-state attribute is “ready” (about 2 s).
  3. 3Assert data-state is “ready” and the class contains “is-ready”.

Acceptance criteria

  • An attribute-based wait is used
  • #dynamic-text reads “Ready” (same timer)
  • At least 2 assertions pass

Constraints

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

Selenium WebDriver 4 · Selenium · Waits & synchronization