views:

261

answers:

1

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\']")
A: 

It appears that your XPATH expressions are mal-formed.

The first XPATH is missing the single quote ' at the end of flash_notice.

It should be:

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

The second XPATH has the ' ] and ) out of order, which messes up the expression.

It should be:

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

Mads Hansen