diff --git a/docs/src/actionability.md b/docs/src/actionability.md index 3acbcf644f..7902d9abbf 100644 --- a/docs/src/actionability.md +++ b/docs/src/actionability.md @@ -1,15 +1,21 @@ --- id: actionability -title: "Actionability" +title: "Auto-waiting" --- -Playwright does a range of actionability checks on the elements before performing certain actions. These checks ensure that action behaves as expected, for example Playwright does not click on a disabled button. +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`. -Playwright waits until all the relevant actionability checks pass before performing an action. This means that action will fail with the `TimeoutError` if checks do not pass within the specified `timeout`. +For example, for [`method: Page.click`], Playwright will ensure that: +- element is [Attached] to the DOM +- 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] -Some actions like [`method: Page.click`] support `force` option that disables non-essential actionability checks, for example passing truthy `force` to [`method: Page.click`] method will not check that the target element actually receives click events. +Here is the complete list of actionability checks performed for each action: -| Action | [Attached] | [Visible] | [Stable] | [Receiving Events] | [Enabled] | [Editable] | +| Action | [Attached] | [Visible] | [Stable] | [Receives Events] | [Enabled] | [Editable] | | :- | :-: | :-: | :-: | :-: | :-: | :-: | | check | Yes | Yes | Yes | Yes | Yes | - | | click | Yes | Yes | Yes | Yes | Yes | - | @@ -32,7 +38,19 @@ Some actions like [`method: Page.click`] support `force` option that disables no | textContent | Yes | - | - | - | - | - | | type | Yes | - | - | - | - | - | -You can check the actionability state of the element using one of the following methods: +
+ +## Forcing actions + +Some actions like [`method: Page.click`] support `force` option that disables non-essential actionability checks, +for example passing truthy `force` to [`method: Page.click`] method will not check that the target element actually +receives click events. + +## Assertions + +You can check the actionability state of the element using one of the following methods as well. This is typically +not necessary, but it helps writing assertive tests that ensure that after certain actions, elements reach +actionable state: - [`method: ElementHandle.isChecked`] - [`method: ElementHandle.isDisabled`] @@ -47,33 +65,32 @@ You can check the actionability state of the element using one of the following - [`method: Page.isHidden`] - [`method: Page.isVisible`] -### Visible +
-Element is considered visible when it has non-empty bounding box and does not have `visibility:hidden` computed style. Note that elements of zero size or with `display:none` are not considered visible. - -### Stable - -Element is considered stable when it has maintained the same bounding box for at least two consecutive animation frames. - -### Enabled - -Element is considered enabled when it is not a `