How can I get all elements from a drop down list? I used the code below:
List elements = driver.findElements(By.id(\"s\"));
This will help to list all the elements from the dropdown:
Select dropdown = new Select(driver.findElement(By.id("id")));
//Get all options
List dd = dropdown.getOptions();
//Get the length
System.out.println(dd.size());
// Loop to print one by one
for (int j = 0; j < dd.size(); j++) {
System.out.println(dd.get(j).getText());
}