Playwright · Junior · Question 38 of 75
Which assertion checks that a button is disabled?
- 1
await expect(button).not.toExist() - 2
await expect(button).toHaveClass('off') - 3
await expect(button).toBeDisabled()
Show the answer
Correct answer: await expect(button).toBeDisabled()
Explanation
toBeDisabled and toBeEnabled check the real disabled state, including aria-disabled for some roles, instead of guessing from CSS classes.