Playwright · Middle · Question 33 of 75

What does locator.and() do?

Show the answer

Correct answer: Matches elements that satisfy both locators

Explanation

For example page.getByRole('button').and(page.getByTitle('Subscribe')) finds a button that also has that title.

Further reading

Problem with a question

Playwright · Middle · question 33

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