Playwright · Middle · Question 66 of 75

Which locator filters buttons by their checked state, like a toggle?

Show the answer

Correct answer: getByRole('checkbox', { checked: true })

Explanation

Role options like checked, pressed, expanded, selected and level match ARIA states.

Further reading

Problem with a question

Playwright · Middle · question 66

Test yourself

Take the Playwright · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz