Your HTML:
<div class="outer blue">
<div class=" inner green">
</div>
</div>
The Selenium RC command, is shown below.
Firefox seems to correctly handle the leading space:
# Will return 1 in FireFox, and 0 in Internet Explorer
browser.get_xpath_count("//*[@class='inner green']")
...while IE doesn't.
# Will return 1 in FireFox, and 1 in Internet Explorer
browser.get_xpath_count("//*[@class='outer blue']")
You may argue (as I have) that the class attribute shouldn't have a leading space. In the Spec, spaces are described as being separators between class attribute values. So the creators/maintainers of the page should 'fix' the HTML, allowing the selenium code/tests to correctly locate the element.
1 comments:
I've stopped using Seleniums built-in methods for getting information, it's too slow. I'm using Hpricot instead.
Post a Comment