CSS `:contains` is a lifesaver *if* you’re using jQuery or a browser that supports it. But since most don’t…
Try XPath axes! Like `following-sibling::` or `ancestor::` to narrow down where the text lives.
Example:
`//div[contains(text(), 'hello')]/following-sibling:
pan`
Also, Browser DevTools (F12) + `Ctrl+F` to test locators before throwing them into Selenium.
Try XPath axes! Like `following-sibling::` or `ancestor::` to narrow down where the text lives.
Example:
`//div[contains(text(), 'hello')]/following-sibling:
pan` Also, Browser DevTools (F12) + `Ctrl+F` to test locators before throwing them into Selenium.
