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.