css=table#playlistTable tr:nth(0) span[class='playlistNumDisplay smallFont']
我在上面的 CSS 中遇到错误。 我想基本上转到“PlaulistTable”下的第一个“tr”,然后在第一个“tr”下我想选择 span[class='playlistNumDisplay smallFont']
我在这里做错了什么? 谢谢你的帮助
最佳答案
您的意思可能是 :nth-child(1)
或 :nth-of-type(1)
而不是简单的 :nth(0)
这是无效的 CSS。
如果您专门寻找第一个匹配项,您还可以使用 :first-child
或 :first-of-type
而不是 nth -()
变体。
Quirksmode 在这里有一个很好的可用选择器列表 http://www.quirksmode.org/css/contents.html (连同浏览器兼容性图表,但我认为在 Selenium 查询的上下文中这与您无关)
希望对您有所帮助。
关于 Selenium 的CSS查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7634163/