Skip to contentPlayForge

What is auto-waiting in Playwright?

Written by Jatin Thacker, Automation Architect · Updated

Auto-waiting is Playwright's built-in mechanism that performs actionability checks before executing any user action on an element. It automatically waits for the target to be attached, visible, stable, enabled, and unobstructed before clicking or typing.

This answer is one piece of Chapter 13: Waiting and Synchronisation.

  • Auto-Waiting Deep Dive
  • Explicit Waiting Methods
  • Handling Race Conditions
  • Controlling the Clock
  • Practice and interview questions: Waiting & Synchronization

In earlier test automation tools, testers were forced to write explicit wait loops before every click or form input to ensure the button was clickable. Playwright eliminates this entire class of boilerplate through auto-waiting.

When you call await locator.click(), Playwright automatically checks actionability: it verifies the element is attached to the DOM, visible on screen, not animating or in motion, enabled, and not covered by an overlay or dialog backdrop. It retries these checks continuously until they pass or your action timeout elapses.

Auto-waiting applies to user interaction methods like click(), fill(), check(), and selectOption(). For assertions, web-first assertions provide the equivalent retry behavior. Together, they mean test code almost never requires manual wait statements.

auto-waiting.spec.js(https://practice.learnplayforge.com)
import { test, expect } from '@playwright/test'; test('auto-waiting ensures actionability before clicking', async ({ page }) => { await page.goto('/catalog.html?mock=static&seed=42&autologin=1'); const searchButton = page.getByTestId('catalog-search-submit'); await searchButton.click(); await expect(page.getByTestId('product-grid')).toBeVisible(); });
Output
1 passed (3.5s)
Test yourself
What actionability checks does Playwright perform automatically before clicking an element with await button.click()?

Practised in the full course: the drill Waiting is not asserting.

See the chapter

AI can write the test now. The job is knowing whether it checks anything. That's what the course teaches, one chapter at a time.

163 lessons · 226 drills · start free

← All questions

Training a team? Talk to us.