I'm trying to use css selector to get an element inside a <li>
with Selenium
That's I have:
<div id= "popup"> <ul> <li> <div id="item" option= "1" ....> </div> </li> <li> <div id="item" option= "2" ....> </div> </li> </ul> </div>
I need to get the second div, with option=2. I tried:
webdriver.findElement(By.cssSelector("#popup > ul li:nth-child(n) [option=2]");
that works fine in console of Chrome but not with Selenium :/ What's wrong with this?