Testing · Middle · Question 34 of 75
Why is getByRole slower than getByText, and what to do about it?
- ✓Correct answer: It computes the accessibility tree; in huge DOMs scope it with
withinor narrow it withname, rather than giving it up - 2It sends a network request
- 3It's not slower
Explanation
In most suites the difference is negligible, and the confidence gained is worth it.