我正在使用selenium2 webdriver和firefox。
通常,当有一个组合框用于例如几个月我用send_keys(monthname)
设置了一个不同的月份。
这次我有一个特殊的列表框,我不能简单send_keys()
到它(不是使用webdriver也不是手动)。我不是网络开发人员,所以我不知道实际的差异是什么。这是该组合框的HTML代码:
<div class="selectArea marke" style="width: 75px; ">
<span class="left"></span>
<span class="center">Month</span>
<span class="selectButton"></span>
<div class="disabled" style="display: none; "></div>
</div>
<select name="sregisterdmc" id="sregisterdmc" class="marke outtaHere" style="width:75px" multiple="">
<option value="">Month</option>
<option value="01">01</option>
...more options...
</select>
我不知道如何在这里设置选项。我发现我可以使用.find_elements_by_tag_name()
获取所有选项值,但不是我现在如何设置这样的值。提前谢谢!
答案 0 :(得分:1)
单击要选择的option
元素。