Testing · Middle · Question 26 of 75
Why can getByRole miss an element that is in the DOM?
- ✓Correct answer: It ignores elements hidden from the accessibility tree (
display: none,aria-hidden) unlesshidden: trueis passed - 2It searches only the first 100 elements
- 3It works only with buttons
Explanation
This is usually what you want: hidden elements aren't available to the user either.