【发布时间】:2014-08-24 21:53:00
【问题描述】:
***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>
我的代码
Select selectBox = new Select(driver.findElement(By.id("type")));
List<WebElement> selectOptions = selectBox.getOptions();
for (WebElement temp : selectOptions)
{
System.out.println(temp.getText());
}
***输出显示 7 次。
全部
车
屋
船
飞机
树
土地
全部
车
屋
船
飞机
树
土地
全部
车
屋
船
飞机
树
土地
全部
车
屋
船
飞机
树
土地
全部
车
屋
船
飞机
树
土地
全部
车
屋
船
飞机
树
土地
I would like to itterate through each options 1 times and select them.
【问题讨论】: