Skip to content
masterclass Buddy

React Testing Library · Function

findByRole

findByRole asynchronously finds one element by its accessible role. Use options such as name or description to distinguish matching elements.

Last updated

Syntax

findByRole(role, options?)

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

Subscribe
  • getByRole
  • queryByRole
  • getAllByRole
  • queryAllByRole
  • findAllByRole
  • screen
  • within

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