Testing & QA Code Completion Medium +20 XP
Testing Library Query
Complete to find an element by its text.
Testing & QAFill in the blank
const btn = screen.___("Submit");Type the missing code
Show answer and explanation
Answer: getByText
getByText() queries the DOM for an element containing the specified text, the most human-readable way to find elements.
Hint: Which query finds elements by their visible text?
What this challenge tests
Code Completion in Testing & QA: testing-library, queries.