Skip to content
masterclass Buddy

React Testing Library · Module

queryByPlaceholderText

queryByPlaceholderText looks for an element whose placeholder attribute matches the given text. It returns null when no element matches and throws when more than one matches.

Last updated

Syntax

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

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

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

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