React Testing Library · Module
getByAltText
getByAltText finds an element by its alt text. It is commonly used for images and can also support other elements that accept alt.
Last updated
Syntax
getByAltText(container: HTMLElement, text: TextMatch, options?: { exact?: boolean, normalizer?: NormalizerFn }): HTMLElementIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
queryByAltTextgetAllByAltTextqueryAllByAltTextfindByAltTextfindAllByAltTextscreenwithinTextMatch