selenium cannot find element with class in IE

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-04-15T16:18:25Z Indexed on 2010/04/17 13:23 UTC
Read the original article Hit count: 264

I'm using selenium_client with cucumber, webrat + IE As you'd expect, Firefox works fine. I've tried the following:

selenium.is_visible("css=#flash .flash_notice")
selenium.is_visible("xpath=//*[@id='flash']/*[@class='flash_notice]")
selenium.is_visible("xpath=//*[@id='flash']/*[contains(@class,'flash_notice]')")

both cannot find the element. I think it must be something to do with IE, looking closer at the html selenium returns from IE... It looks like this:

<UL id=flash>
  <LI className=flash_notice>Deleted</LI>
</UL>

Notice IE returns the class attribute as className, is this confusing selenium? How can I get round this so that I can use the same statement for selenium using IE and Firefox

Just to confuse us even more, this example works, confirming its something to do with checking the class attribute

selenium.is_visible("xpath=//*[@id='flash']/*[. =\'Deleted\']")

© Stack Overflow or respective owner

Related posts about selenium

Related posts about cucumber