下拉在硒中没有起作用

时间:2017-05-03 10:24:16

标签: selenium xpath selenium-webdriver

我喜欢从下拉列表中选择,我已经编写了上面的代码。 xpath有效,但仍然无效。请指导我。性别下降我做了同样的事情。但问题仍然存在。

Select dropdown2 = new Select(driver.findElement(By.xpath("//*[@class='select2-choice']/span[@id='select2-chosen-3']"))); dropdown2.selectByVisibleText("Male");



xs-4 agent_title">Gender </div>
<div class="col-sm-4 col-xs-8">
<div id="s2id_partySex" class="select2-container form-control select2me" style="display: block; font-size: 14px; line-height: 1.42857; color: rgb(85, 85, 85); background-color: rgb(255, 255, 255); background-image: none; border: 1px solid rgb(204, 204, 204); border-radius: 4px; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset; transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;">
<label class="select2-offscreen" for="s2id_autogen2"></label>
<input id="s2id_autogen2" class="select2-focusser select2-offscreen" aria-haspopup="true" role="button" aria-labelledby="select2-chosen-2" type="text">
<a class="select2-choice" href="javascript:void(0)" tabindex="-1">
</div>
<select id="partySex" class="form-control select2me select2-offscreen" name="partySex" style="display: block; font-size: 14px; line-height: 1.42857; color: rgb(85, 85, 85); background-color: rgb(255, 255, 255); background-image: none; border: 1px solid rgb(204, 204, 204); border-radius: 4px; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset; transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;" tabindex="-1" title="">
</div>
<div id="error_gender"></div>
</div>
<div class="agent-row">
<div class="agent-row">
<div class="agent-row">
<div class="agent-row">
<div class="agent-row">
<div class="agent-row">
<div class="agent-row">
<div class="agent-row">
</div>
</div>
<div id="address" class="tab-pane fade">
<div id="otherinfo" class="tab-pane fade">
<div id="kyc" class="tab-pane fade">
</div>
</div>
</div>
&#13;
&#13;
&#13;

] 1] 1

0 个答案:

没有答案