Skip to content
masterclass Buddy

React Testing Library · Module

findByAltText

findByAltText finds an element by matching its alt text. It waits and retries until the element appears, then returns a promise for that element.

Last updated

Syntax

findByAltText(text: TextMatch, options?: { exact?: boolean; normalizer?: NormalizerFn }): Promise<HTMLElement>

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

Subscribe
  • getByAltText
  • queryByAltText
  • getAllByAltText
  • queryAllByAltText
  • findAllByAltText
  • screen
  • within
  • TextMatch

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