使用xpath无法在selenium中找到select元素



我无法在fire-foc浏览器中为以下HTML 找到select元素

我正在尝试xpath".//*[@id='div_2_1_2_1_1_select']"请帮助

 <div id="div_2_1_2_1_1_1_formGroup" class="form-group">
        <label id="div_2_1_2_1_1_1_selectLabel" class="control-label"  for="div_2_1_2_1_1_1_select">Document Type</label>
<div id="div_2_1_2_1_1_1_formCol">
<select id="div_2_1_2_1_1_1_select" class="form-control">
<option value="ID Proof Document">ID Proof Document</option>
</select>
</div>
</div>

使用此代码进行定位。

Select dropDown = new Select(driver.findElement(By.xpath("//select[@id='div_2_1_2_1_1_1_select']")))

请尝试以下操作:-

//select[@id='div_2_1_2_1_1_1_select' and @class='form-control']

希望它能帮助你:)

最新更新