Reputation: 7604
I would like to use the following css in my selenium function:
nth-of-type()
is this supported on all browsers and all versions, or do i need to be careful in using it. If so, what all browsers/versions are supported?
thanks
Upvotes: 3
Views: 943
Reputation: 9474
Quoted from the Sauce Labs blog:
For those of you using or willing to use Selenium 2/Webdriver, you may want to re-consider the special Sizzle pseudoclases like :contains or :nth that I’m talking about in this blog post. For technical reasons, injecting Sizzle in browsers driven by Selenium 2 is not as cheap as with Selenium 1, so the Devs have decided to rely on the browsers’ implementation of CSS (standard CSS only) and fallback to Sizzle when needed (in case of old browsers which don’t provide native css selecting for JavaScript). In Selenium 2 land, my advice, sadly, is to stick to the standard and avoid most of these shortcuts.
So, it is dependent on the browser if you use a recent Selenium version. Use a CSS support overview site to determine it for individual browsers by searching for the locator you're interested in.
Upvotes: 2