How to get the count of elements in list box?
working on selenium + java,. can any one help me... I have a drop down list box, and need to get the number of elements in the list box.
<select id="id"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select>
need to get the count, ie, 3..... thanks and in advance
Try this , storing all the Web elements of Select list in a List and then getting its size.
List optionCount = driver.findElements(By.xpath("//select/option")); System.out.println(optionCount.size());