Auto-waiting
Info
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 click()
action, Playwright will ensure that:
- locator resolves to an 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
Here is the complete list of actionability checks performed for each action:
Action | Visible | Stable | Receives Events | Enabled | Editable |
---|---|---|---|---|---|
Check | - | ||||
Click | - | ||||
Double Click | - | ||||
setChecked | - | ||||
Tap | - | ||||
Uncheck | - | ||||
Hover | - | - | |||
dragTo | - | - | |||
Screenshot | - | - | - | ||
Fill | - | - | |||
Clear | - | - | |||
selectOption | - | - | - | ||
selectText | - | - | - | - | |
scrollIntoViewIfNeeded | - | - | - | - | |
Blur | - | - | - | - | - |
dispatchEvent | - | - | - | - | - |
Focus | - | - | - | - | - |
Press | - | - | - | - | - |
pressSequentially | - | - | - | - | - |
setInputFiles | - | - | - | - | - |
Checkout the Playwright documentation here