Skip to content
SDETRole
SDETRole

Glossary · UI automation

Auto-waiting

Also called: auto-wait, auto wait, actionability checks

Definition

A framework feature that waits for an element to be ready, for example visible, stable and enabled, before acting on it, instead of relying on fixed sleeps.

Auto-waiting means the automation framework checks that an element is ready before it performs an action, and keeps retrying until it is or until a timeout expires. Playwright and Cypress build this in. In Playwright, click() waits for the element to be attached, visible, stable (not animating), able to receive events (not covered by another element) and enabled. You write the action; the framework handles the timing.

Example

import { test, expect } from '@playwright/test';

test('saves the profile', async ({ page }) => {
  await page.goto('/profile');
  await page.getByLabel('Display name').fill('Ada');
  // Waits until the button is visible, stable, enabled and not covered
  await page.getByRole('button', { name: 'Save' }).click();
  // Retries until the toast appears or the expect timeout is reached
  await expect(page.getByRole('status')).toHaveText('Profile saved');
});

There is no waitForTimeout anywhere. If the save button is disabled for a moment while the form validates, the click waits rather than failing.

How it differs from explicit and implicit waits

Selenium WebDriver does not auto-wait before actions. You either set an implicit wait, which only affects how long findElement polls for an element to exist, or write an explicit wait with WebDriverWait and an ExpectedConditions check such as elementToBeClickable. Auto-waiting is closer to an explicit wait that the framework writes for you on every action, with checks chosen for that action: fill() also requires the element to be editable, for instance.

Limits

  • It waits for the element, not for your business state. If the button is clickable before the data it submits has loaded, auto-waiting won’t save you. Assert on the state you need first.
  • It does not apply to values you read once. await locator.textContent() returns whatever is there now. To wait for text, use a web-first assertion like toHaveText.
  • It can hide slowness. A step that always takes most of its timeout passes but is a performance signal worth looking at in the trace.
  • force: true skips the checks. It is occasionally needed for custom controls, but it is usually masking a real problem.

Type to search across SDETRole.

Full-text search by Pagefind · runs in your browser Open search page →