📄 playwright-python/java/docs/test-assertions

File: test-assertions.md | Updated: 11/18/2025

Source: https://playwright.dev/java/docs/test-assertions

Skip to main content

On this page

List of assertions


| Assertion | Description | | --- | --- | | assertThat(locator).isAttached() | Element is attached | | assertThat(locator).isChecked() | Checkbox is checked | | assertThat(locator).isDisabled() | Element is disabled | | assertThat(locator).isEditable() | Element is editable | | assertThat(locator).isEmpty() | Container is empty | | assertThat(locator).isEnabled() | Element is enabled | | assertThat(locator).isFocused() | Element is focused | | assertThat(locator).isHidden() | Element is not visible | | assertThat(locator).isInViewport() | Element intersects viewport | | assertThat(locator).isVisible() | Element is visible | | assertThat(locator).containsClass() | Element has specified CSS classes | | assertThat(locator).containsText() | Element contains text | | assertThat(locator).hasAccessibleDescription() | Element has a matching accessible description | | assertThat(locator).hasAccessibleName() | Element has a matching accessible name | | assertThat(locator).hasAttribute() | Element has a DOM attribute | | assertThat(locator).hasClass() | Element has a class property | | assertThat(locator).hasCount() | List has exact number of children | | assertThat(locator).hasCSS() | Element has CSS property | | assertThat(locator).hasId() | Element has an ID | | assertThat(locator).hasJSProperty() | Element has a JavaScript property | | assertThat(locator).hasRole() | Element has a specific ARIA role | | assertThat(locator).hasText() | Element matches text | | assertThat(locator).hasValue() | Input has a value | | assertThat(locator).hasValues() | Select has options selected | | assertThat(locator).matchesAriaSnapshot() | Element matches provided Aria snapshot | | assertThat(page).hasTitle() | Page has a title | | assertThat(page).hasURL() | Page has a URL | | assertThat(response).isOK() | Response has an OK status |