I\'ve been hacking away at this one for hours and I just can\'t figure it out. Using XPath to find text values is tricky and this problem has too many moving parts.
text()
gets you a set of text nodes. I tend to use it more in a context of //span//text() or something.
If you are trying to check if the text inside an element contains something you should use contains
on the element rather than the result of text()
like this:
span[contains(., 'testuser')]
XPath is pretty good with context. If you know exactly what text a node should have you can do:
span[.='full text in this span']
But if you want to do something like regular expressions (using exslt for example) you'll need to use the string() function:
span[regexp:test(string(.), 'testuser')]