XPath with `contains(text(), '...')` is my go-to for selenium locators to find particular text, but yeah, it can get messy.
One trick? Use `normalize-space()` to handle extra whitespace or line breaks. Like:
`//*[contains(normalize-space(), 'your_text')]`
Also, if the site’s dynamic, try waiting for the element *with* the text instead of just the element. Saves a ton of headaches.
For tools, check out ChroPath (Chrome extension)—super handy for testing XPaths/CSS live.
One trick? Use `normalize-space()` to handle extra whitespace or line breaks. Like:
`//*[contains(normalize-space(), 'your_text')]`
Also, if the site’s dynamic, try waiting for the element *with* the text instead of just the element. Saves a ton of headaches.
For tools, check out ChroPath (Chrome extension)—super handy for testing XPaths/CSS live.
