Skip to main content

Auto-waiting

Introduction​

Playwright performs a range of actionability checks on the elements before making actions to ensure these actions behave as expected. It auto-waits for all the relevant checks to pass and only then performs the requested action. If the required checks do not pass within the given timeout, action fails with the TimeoutError.

For example, for locator.click(), Playwright will ensure that:

  • locator resolves to exactly one element
  • element is Visible
  • element is Stable, as in not animating or completed animation
  • element Receives Events, as in not obscured by other elements
  • element is Enabled
  • element is Not Inert

Here is the complete list of actionability checks performed for each action:

ActionVisibleStableReceives EventsEnabledEditableNot Inert
locator.check()YesYesYesYes-Yes
locator.click()YesYesYesYes-Yes
locator.dblclick()YesYesYesYes-Yes
locator.setChecked()YesYesYesYes-Yes
locator.tap()YesYesYesYes-Yes
locator.uncheck()YesYesYesYes-Yes
locator.hover()YesYesYes---
locator.dragTo()YesYesYes---
locator.screenshot()YesYes----
locator.fill()Yes--YesYesYes
locator.clear()Yes--YesYesYes
locator.selectOption()Yes--Yes-Yes
locator.selectText()Yes-----
locator.scrollIntoViewIfNeeded()-Yes----
locator.blur()------
locator.dispatchEvent()------
locator.focus()------
locator.press()------
locator.pressSequentially()------
locator.setInputFiles()-