I am automating a website using Selenium C#. I am getting NoSuchElementException while trying to click element using CSS selector. But when I use xpath things are working. Can anyone help me understand why I am having this issue while using CSS selector.
Xpath value used.
//*[@id="primary-navigation"]/ul/li[2]/a
CSS Selector value used.
#primary-navigation > ul > li:nth-child(2) > a
li:nth-child(n)!=li[n]