React Testing Library · Module
queryByLabelText
getByLabelText finds a form control by its label or aria-label. It is useful when a test should interact with a control the way a user identifies it.
Last updated
Syntax
getByLabelText(container: HTMLElement, text: TextMatch, options?: { selector?: string; exact?: boolean; normalizer?: NormalizerFn }): HTMLElementIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
queryByLabelTextgetAllByLabelTextqueryAllByLabelTextfindByLabelTextfindAllByLabelTextgetByRolescreenrender