Skip to content
masterclass Buddy

React Testing Library · Module

getByTitle

Use getByTitle to find an element with a matching title attribute. In React tests, render the component and call screen.getByTitle.

Last updated

Syntax

getByTitle(container: HTMLElement, title: TextMatch, options?: { exact?: boolean = true, normalizer?: NormalizerFn }): HTMLElement

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

Subscribe
  • queryByTitle
  • getAllByTitle
  • queryAllByTitle
  • findByTitle
  • findAllByTitle
  • render
  • screen

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