Skip to content
masterclass Buddy

React Testing Library · Function

getByPlaceholderText

getByPlaceholderText finds one element whose placeholder attribute matches the given text. In React Testing Library, use it through screen after rendering a component.

Last updated

Syntax

getByPlaceholderText(container: HTMLElement, text: TextMatch, options?: { exact?: boolean; normalizer?: NormalizerFn }): HTMLElement

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

Subscribe
  • queryByPlaceholderText
  • getAllByPlaceholderText
  • queryAllByPlaceholderText
  • findByPlaceholderText
  • findAllByPlaceholderText
  • getByLabelText
  • screen
  • within

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