Try the following code:
//...
By mySelector = By.xpath("/html/body/div[1]/div/section/div/div[2]/form[1]/div/ul/li");
List<WebElement> myElements = driver.findElements(mySelector);
for(WebElement e : myElements) {
System.out.println(e.getText());
}
It will returns with the whole content of the <li>
tags, like:
<a class="extra">Vše</a> (950)</li>
But you can easily get the number now from it, for example by using split()
and/or substring()
.