这是我的 HTML:
<tbody>
<tr>
<td colspan="2" style="text-align:center;font-weight:bold;padding-bottom:10px;">You have Statewide Access<br>Please select the district in which you want to operate</td>
</tr>
<tr>
<td style="text-align:right;width:50%;font-weight:bold;padding-right:10px;"><label for="districtOption">Select District</label></td>
<td style="text-align:left;width:50%;">
<select id=`district Option` name="district Option" size="0" alt="Select District" tab index="1">
<option value="00" selected="">-- SELECT --</option>
<option value="01"> A1 </option>
<option value="02"> A2 </option>
</select>
</td>
</tr>
我的第一次尝试:
Select select = new Select(driver.findElement(By.xpath("//select[@id='distrctOption']")));
select.selectByVisibleText("A1");
第二次尝试:
Select dropdown = new Select(driver.findElement(By.id("districtOption")));
dropdown.selectByIndex(01);
driver.findElement(By.xpath("//[@value='Select']")).click();
控制台中每次执行一个错误消息“线程“main”中的异常
org.openqa.selenium.NoSuchElementException Unable to locate element"
*** Element info: {Using=xpath, value=//select[@id='districtOption']}
我尝试了所有可能的方法?
页面中没有框架,但仍然无法选择它。
芜湖不芜
森栏
相关分类