--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
I suspect your HTML is more complex than the example you’ve shown us –in particular, that the identical <DIV>s are not contained within the same parent element. That would explain your problems. XPath’s position() function (and its shorthand form “[n]”) doesn’t do what most folks think it does. It selects elements that are at the specified position relative to their parent element, not relative to the page or to some deeper ancestor element. Thus “div[@class=’content’][2]” means “the div that has the CSS class ‘content’ and that is the second node within its enclosing node”, which is only true when the <DIV>s are all in the same container (as in your example).
If you really want the n’th element matching some XPath expression, you need to use “xpath=(...the expression...)[n]”, which means “the n’th node in the set of nodes selected by ‘...the expression...’”. For example, “xpath=(//div[@class=’content’])[2]”. Note the use of the parentheses – they’re critical.
Ross