I'm trying to work out how to efficiently grab an element from a page that contains a specific string.
The element is in an <a>
tag however it's classes/ids are randomly generated.
The only way I can achieve this is by looping over every <a>
tag and checking if the textContent matches.
<a>Match this text foo</a>
I've also tried using the xPath expression however I can figure out how to use the returned elements.
//a[contains(text(),'Match this text')]
Anyone have a better solution?