Playwright Native Test
toBeChecked
DocsEnsures the Locator points to a checked input.
toBeDisabled
DocsEnsures the Locator points to a disabled element. Element is disabled if it has 'disabled' attribute or is disabled via 'aria-disabled'. Note that only native control elements such as HTML button, input, select, textarea, option, optgroup can be disabled by setting 'disabled' attribute. 'disabled' attribute on other elements is ignored by the browser.
linktoBeEditable
DocsEnsures the Locator points to an editable element.
toBeEmpty
DocsEnsures the Locator points to an empty editable element or to a DOM node that has no text.
toBeEnabled
DocsEnsures the Locator points to an enabled element.
toBeFocused
DocsEnsures the Locator points to a focused DOM node.
toBeHidden
DocsEnsures that Locator either does not resolve to any DOM node, or resolves to a non-visible one.
toBeVisible
DocsEnsures that Locator points to an attached and visible DOM node.
Html ElementTitle of hidden text
Hidden Details ExampleTitle of visible text
toContainText
DocsEnsures the Locator points to an element that contains the given text. You can use regular expressions for the value as well. If you pass an array as an expected value, the expectations are:
- Locator resolves to a list of elements.
- Elements from a subset of this list contain text from the expected array, respectively.
- The matching subset of elements has the same order as the expected array.
- Each text value from the expected array is matched by some element from the list.
- Item Text 1
- Item Text 2
- Item Text 3
toHaveAttribute
DocsEnsures the Locator points to an element with given attribute.
toHaveClass
DocsEnsures the Locator points to an element with given CSS classes. This needs to be a full match or using a relaxed regular expression.
toHaveCss
DocsEnsures the Locator resolves to an element with the given computed CSS style.
toHaveId
DocsEnsures the Locator points to an element with the given DOM Node ID.
toHaveText
DocsEnsures the Locator points to an element with the given text. If you pass an array as an expected value, the expectations are:
- Locator resolves to a list of elements.
- The number of elements equals the number of expected values in the array.
- Elements from the list have text matching expected array values, one by one, in order.
- Text 1
- Text 2
- Text 3
toHaveValue
DocsEnsures the Locator points to an element with the given input value. You can use regular expressions for the value as well.
toHaveValues
DocsEnsures the Locator points to multi-select/combobox (i.e. a select with the multiple attribute) and the specified values are selected.
toHaveTitle
DocsEnsures the page has the given title.
toHaveURL
DocsEnsures the page is navigated to the given URL.