diff --git a/docs/README.md b/docs/README.md index 2a3f138123..ce2625487c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -54,6 +54,7 @@ - [Loading a popup](./loading.md#loading-a-popup) - [Client-side redirects](./loading.md#unusual-client-side-redirects) - [Navigation after a timeout](./loading.md#click-triggers-navigation-after-a-timeout) +1. [Actionability](./actionability.md) 1. [Continuous Integration](./ci.md) - [Docker](./ci.md#docker) - [GitHub Actions](./ci.md#github-actions) diff --git a/docs/actionability.md b/docs/actionability.md new file mode 100644 index 0000000000..de40e765c6 --- /dev/null +++ b/docs/actionability.md @@ -0,0 +1,55 @@ +# Actionability + +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 waits until all the relevant actionability checks pass before performing an action. This means that action will fail with `TimeoutError` if checks do not pass within the specified `timeout`. + +Some actions like `page.click()` support `{force: true}` option that disable non-essential actionability checks, for example passing `force` to `click()` method will not check that the target element actually receives click events. + +| Actions | Performed checks | +| ------ | ------- | +| `check()`
`click()`
`dblclick()`
`hover()`
`uncheck()` | [Visible]
[Stable]
[Enabled]
[Receiving Events]
[Attached]† | +| `fill()` | [Visible]
[Enabled]
[Editable]
[Attached]† | +| `focus()`
`press()`
`setInputFiles()`
`selectOption()`
`type()` | [Attached]† | +| `selectText()` | [Visible] | +| `dispatchEvent()`
`scrollIntoViewIfNeeded()` | -- | +| `getAttribute()`
`innerText()`
`innerHTML()`
`textContent()` | [Attached]† | + +† [Attached] check is only performed during selector-based actions. + +### Visibile + +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 maintanined the same bounding box for at least two consecutive animation frames. + +### Enabled + +Element is considered enabled when it is not a `