Don;t try to play complex CSS with Selenium. You can try something you used to from jQuery, but it doesn't exist in CSS, or at least the current version of CSS supported by the browser you try it on. 'nth' might be on example of this.
So, simplifying it to:
css=table#playlistTable tr:first-child span.playlistNumDisplay.smallFont
You might consider even simplifying it more, according to which parts of the selector you care about matching, and which are not overlapping with other elements.
.
Note that :first-child
is CSS 2.1, while :nth-child()
and attribute value selectors (as in [class='...']
) are CSS 3, meaning more browser support for the first than the others.
.
One thing that helps as well is using a jQuery locator, which can be implemented as in:
How do I add a JQuery locators to Selenium Remote Control
Of course will be limited to pages supporting jQuery. BTW, we have been using this exact one in a very large e-commerce website pretty successfully.