Skip to content
masterclass Buddy

React Testing Library · Module

findByLabelText

getByLabelText finds the form control associated with matching label text. It supports common label relationships and can be called as screen.getByLabelText in React Testing Library.

Last updated

Syntax

getByLabelText(container: HTMLElement, text: TextMatch, options?: { selector?: string, exact?: boolean, normalizer?: NormalizerFn }): HTMLElement

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • getByRole
  • queryByLabelText
  • getAllByLabelText
  • queryAllByLabelText
  • findByLabelText
  • findAllByLabelText
  • screen

Source: ByLabelText | Testing Library. Checked 2026-11-03.