An element is in a state
Passes when an element on the page exists, is visible, enabled, checked, focused or in view, or is absent.
selector is state
Details #
state is exists (the default), absent, visible, hidden, enabled, disabled, checked, unchecked, focused or inViewport. A missing element counts as hidden. With text, only elements whose text contains it (or matches /regex/) count.
In a waitFor or waitChange step the condition is checked again and again, so "wait until the spinner is gone" is a browser.element condition with absent.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
selector | text | Yes | The element. Required. | |
html | text | |||
impersonate | one of | auto chrome safari none | ||
sample | any value | |||
signIn | text | |||
state | one of | exists absent visible hidden enabled disabled checked unchecked focused inViewport | One of the states above. | |
tab | any value | Which tab. | ||
text | text | Only elements with this text. | ||
url | text | , html, via, signIn, impersonate: Check a page nobody has open. A fetched page has no layout, so visible, hidden, focused and inViewport need an open tab; the other states work. | ||
via | one of | fetch tab |
Examples #
Click Continue when it is enabled
Do
- Click “text=Continue” on the page
Gotchas #
focusedandinViewportneed the page to be the front tab to be meaningful.