React Testing Library · Function
getByLabelText
getByLabelText finds a form control through its label text or aria-label. It is useful for testing form fields as users identify them.
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
queryByLabelTextgetAllByLabelTextqueryAllByLabelTextfindByLabelTextfindAllByLabelTextgetByRolescreen