XPath interpretation from Selenium / WebDriver driving IE

I am trying to use Selenium RC and WebDriver (separately) to control an HTML page. The source contains something like:

<a href="/logoff"><span>
    <span>L</span>
    ogoff
    </span>
</a>

I want to target a link containing the text "Output" so that it will work anyway, even if they rework the gaps. I use XPath, as this should work in both WebDriver and Selenium RC. This works in IE, but a little fragile:

//a[contains(., 'ogoff')]

and it will be more reliable, but does not work:

//a[.='Logoff']

Can you explain why the second is not working? In particular, how should it be interpreted .as a string, and how do Selenium and WebDriver do this?

I am trying to get Selenium to work with Firefox as well to open yet another worm maker.

+5
2

( ), a.

a, *<xsl:value-of select="a"/>*, :

* L
    ogoff
     *

*<xsl:value-of select="normalize-space(a)"/>*, :

*L ogoff*

" ", normalize-space(), translate(), :

//a[translate(normalize-space(), ' ','')='Logoff']
+10

Selenium link="Logoff", Logoff - .

+2

All Articles