-1

I have the DOM structure as follows.

<ul>
  <li>
    <a href="#" role="button" class="js-pagination link" data-page="1">1</a>
  </li>
  <li>
    <a href="#" role="button" class="js-pagination link active" data-page="2">2</a>
  </li>
  <li>
    <a href="#" role="button" class="js-pagination link " data-page="3">3</a>
  </li>
  <li>
    <a href="#" role="button" class="js-pagination link " data-page="4">4</a>
  </li>
</ul>

I have to select next immediate element (not adjacent element) after element that contains class="js-pagination link active". In our case it is third li element. I tried the following css selector

"ul li a[class='js-pagination link active'] + li"

But it is not working since its looking for li in the same level of a tag. How can we do it using css selector?

I cannot use .has() since I am using this selector in selenium css select to find elements.

Vivek Srinivasan
  • 1,759
  • 1
  • 14
  • 15
  • 1
    Possible duplicate of [Is there a CSS parent selector?](http://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector) – CBroe Oct 25 '16 at 10:40
  • having .active in the last element wont happen in my case. So currently not considering it – Vivek Srinivasan Oct 25 '16 at 10:45