testing-library / dom-testing-library

🐙 Simple and complete DOM testing utilities that encourage good testing practices.
https://testing-library.com/dom
MIT License
3.26k stars 466 forks source link

TestingLibraryElementError: Unable to find an element with the text - This could be because the text is broken up by multiple elements #1196

Closed por14571-jochoa closed 1 year ago

por14571-jochoa commented 1 year ago

Hello, I have a problem, i try to find some elements and gets a problem with the library, it doesn't find the queries.

If someone know about how to fix this problem.

TestingLibraryElementError: Unable to find an element with the text: /Texto./i. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

image


❓ Support Forums

ISSUES WHICH ARE QUESTIONS WILL BE CLOSED

timdeschryver commented 1 year ago

Closing this this because it isn't an issue. If you need some help try our discord server or stackoverflow and share a reproducible example.

por14571-jochoa commented 1 year ago

Thanks, I can solve the problem.

jed212 commented 6 months ago

@por14571-jochoa How did you solve this problem?

github-actions[bot] commented 5 months ago

Uh oh! @snolan-ethika, the image you shared is missing helpful alt text. Check https://github.com/testing-library/dom-testing-library/issues/1196#issuecomment-1998406417.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

snolan-ethika commented 5 months ago

@por14571-jochoa How did you solve this problem?

I stumbled upon this thread, it kind of pointed me in the right direction finally... hope it helps you out https://stackoverflow.com/a/65951158

thamaraRD commented 4 months ago

Thanks, I can solve the problem.

Hello, tell us how you solved it, please

snolan-ethika commented 4 months ago

Thanks, I can solve the problem.

Hello, tell us how you solved it, please

@thamaraRD I was able to solve this by manually setting the component's template with the necessary info, it doesn't feel right having to do this, but it was getting me by. I didn't spend a lot of time figuring out another way, but this helped me get it going.

ref: https://stackoverflow.com/a/65951158