XPath: Select element by class

Today I was writing some Selenium unit tests for our PHPUnit test suite and needed to check if a certain navigational tab was active. Situation in HTML:

<span class="navbutton active">
  <input type="submit" name="someId" value="Button 1"/>
  <input type="submit" name="someOtherId" value="Button 2"/>
</span>
  

I needed to check if Button 1 was active. The problem was that with simple xpath constructs like //span[@class='active']/input do not work since the class may have multiple values.

The rescue was the contains function: //span[contains(@class, 'active')]/input[@id='someId'] as parameter to assertElementPresent().

Update 2009-06-09

Jakob Westhoff has a better solution to this problem.

Comments? Please send an e-mail.