***HTML***
<select id="type" class="dropdownValues" name="type">
<option class="dropdownValues" selected="selected" value="00">All</option>
<option class="dropdownValues" value="01">Car</option>
<option class="dropdownValues" value="02">House</option>
<option class="dropdownValues" value="03">Boat</option>
<option class="dropdownValues" value="04">Plane</option>
<option class="dropdownValues" value="05">Tree</option>
<option class="dropdownValues" value="06">Land</option>
</select>
My Code
Select selectBox = new Select(driver.findElement(By.id("type")));
List<WebElement> selectOptions = selectBox.getOptions();
for (WebElement temp : selectOptions)
{
System.out.println(temp.getText());
}
***The Output is displaying 7 times.
All
Car
House
Boat
Plane
Tree
Land
All
Car
House
Boat
Plane
Tree
Land
All
Car
House
Boat
Plane
Tree
Land
All
Car
House
Boat
Plane
Tree
Land
All
Car
House
Boat
Plane
Tree
Land
All
Car
House
Boat
Plane
Tree
Land
I would like to itterate through each options 1 times and select them.