Playwright · Middle · Question 48 of 75
How do you read the texts of all matching elements?
- 1
await items.allTextContents() - 2
await items.textContentsAll() - 3
await items.map(i => i.innerText)
Show the answer
Correct answer: await items.allTextContents()
Explanation
allTextContents and allInnerTexts return arrays but don't wait. Prefer toHaveText([...]) for assertions, which retries.