谁能帮帮我。我正在尝试使用selenium IDE从下拉列表中选择一个选项,但无法做到。下面是HTML.I。我尝试在目标中对xpath使用“select”命令,但无法从选项中进行选择
<select id="age" class="default chzn-done"onfocus="javascript:setOmnitureFallout('birthdate');"name="ctl00$ContentPlaceHolder1$age" style="display: block; visibility: hidden;" tabindex="21">
<option value="0">0 - 11 months</option>
<option value="1">1 year</option>
<option value="2">2 years</option>
<option value="3">3 years</option>
</select>
<div id="age_chzn" class="chzn-container chzn-container-single chzn-container-active" style="width: 200px;" tabindex="21">
<a class="chzn-single" tabindex="-1">
<span style="background-color: transparent;">2 years</span>
<div>
<b/>
</div>
</a>
<div class="chzn-drop" style="left: -9000px; width: 198px; top: 41px;">
<div class="chzn-search" style="">
<ul class="chzn-results">
<li id="age_chzn_o_0" class="active-result" style="">Select one</li>
<li id="age_chzn_o_1" class="active-result" style="">0 - 11 months</li>
<li id="age_chzn_o_2" class="active-result" style="">1 year</li>
<li id="age_chzn_o_3" class="active-result result-selected" style="">2 years</li>
<li id="age_chzn_o_4" class="active-result" style="">3 years</li>
</ul>发布于 2016-04-28 13:37:26
这就是我通常使用'select‘命令的方式
Using select command
对于select元素定位器,我通常使用它的xpath,而对于选项定位器,我将使用label,它可以指定为正则表达式。例如:
label=regexp:^This_Matches_the_Option_I_want_to_Select$希望这能有所帮助。
我们可以给你一个更具体的答案,如果你张贴网页的html代码片段,你正在工作的网页和你已经编写的代码。
如果你有任何问题,请告诉我。
https://stackoverflow.com/questions/31979423
复制相似问题