I know that WebDriver can locate links through their text, using
Is it possible to locate any element (such as
span, ...) by text?
As User246 mentioned, the xpath support depends on the browser. I have found a few problems with using XPath cross-browser. My solution for this problem was to find elements by tag name first, then iterate through the list of elements matching the tag and look for the attributes that I want to match on as well.