I want find the numberof lis items (li) in html below:
<div class="li-control-block">
<div class="inner">
<a class="scroll-left" href="?slideId=7">
<img width="59" height="30" alt="btn-hero-promo-slider-left" src="/c/images/btn-hero-promo-slider-left.png">
</a>
<ul class="slides-8">
<li class="first">
<a href="#">1</a>
</li>
<li class="">
<a href="#">2</a>
</li>
<li class="">
<a href="#">3</a>
</li>
<li class="">
<a href="#">4</a>
</li>
<li class="">
<a href="#">5</a>
</li>
<li class="">
<a href="#">6</a>
</li>
<li class="">
<a href="#">7</a>
</li>
<li class="last on">
</ul>
<a class="scroll-right" href="?slideId=1">
</div>
</div>
I have tried code below but that comes back with "12345678" which gives me size of 1.
So how can I get the size to be equal to 8 ?
List<WebElement> list=null;
list = driver.findElements(By.cssSelector(".slides-8"));
int length = list.size();
Try doing