JS Testing Academy · QA Demo Site

Dynamic Properties

Elements that change after a few seconds. This is where Thread.sleep fails and explicit waits win.

Reload the page to restart all the timers.

Practice tasks

  1. Wait for the first button to become enabled with an explicit wait, then click it.
  2. Wait until the second button's colour changes and assert the new CSS colour value.
  3. Wait for the third button to become visible and assert it is displayed.
  4. Wait for the text to load and assert its content – without using a fixed sleep.
Sample automation code
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));

WebElement enabled = wait.until(ExpectedConditions.elementToBeClickable(By.id("enable-after")));
enabled.click();

wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("visible-after")));
wait.until(ExpectedConditions.textToBePresentInElementLocated(
        By.id("load-text"), "loaded after"));