React Testing Library · Module
queryAllByRole
ByRole queries find elements by their ARIA role, including native HTML roles, with optional accessible-name and state filters. Choose get, query, or find variants based on whether absence should throw and whether the DOM changes asynchronously.
Last updated
Syntax
getByRole(container: HTMLElement, role: string, options?: { hidden?: boolean; name?: TextMatch; description?: TextMatch; selected?: boolean; busy?: boolean; checked?: boolean; pressed?: boolean; suggest?: boolean; current?: boolean | string; expanded?: boolean; queryFallbacks?: boolean; level?: number; value?: { min?: number; max?: number; now?: number; text?: TextMatch } }): HTMLElementIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
getByRolequeryByRolegetAllByRolequeryAllByRolefindByRolefindAllByRolescreenwithin