diff --git a/docs/dom-testing-library/api-queries.md b/docs/dom-testing-library/api-queries.md index 7b9ff55b5..51f602db3 100644 --- a/docs/dom-testing-library/api-queries.md +++ b/docs/dom-testing-library/api-queries.md @@ -164,8 +164,12 @@ cy.getByLabelText('username').should('exist') -It will NOT find the input node for label text broken up by elements. For this -case, you can provide a `selector` in the options: +It will NOT find the input node for label text broken up by elements. You can +use `getByRole('textbox', { name: 'Username' })` instead which is robust against +switching to `aria-label` or `aria-labelledby`. + +If it is important that you query an actual `