i am trying to fetch all values from dropdown list using selenide . using selectOptionByValue("0") i can fetch one value.But i need all values inside dropdown list.let me know how to do this using selenide code
Asked
Active
Viewed 1,854 times
3 Answers
1
Maybe, you could try to use something like this:
$$(By.xpath("//path/to/element")).iterator().forEachRemaining(element -> {
/**
* your code here, describe here what to do with each element found by the xpath
* e.x.
* element.click();
*/
});
I used it to click through all links on the page with specific class
attribute.

Chris Emerson
- 13,041
- 3
- 44
- 66

Ivan
- 11
- 2
0
Try this solution:
Select select = new Select($(By.id("<SELECT_ID>")));
List<WebElement> elements = select.getOptions();

Tunaki
- 132,869
- 46
- 340
- 423

Konstantin Firsanov
- 64
- 3
0
You could use ElementsCollection:
ElementsCollection listOfElements = $$(By.cssSelector(".its_a_spicy_meatball"));
Note the two $
symbols - this denotes an the object as an ElementCollection
Example:
for(SelenideElement element : listOfElements){
element.click();
}

Michael Dally
- 195
- 3
- 12