我正在尝试使用相邻的同级从下拉列表中选择值,但不起作用
这里是HTML:
<div id="dependsOnQuestionDiv"><div class="x-form-field-wrap x-form-field-trigger-wrap" id="ext-gen197" style="width: 17px;"><input type="text" size="24" autocomplete="off" id="dependsOnQuestion" name="dependsOnQuestion" class="x-form-text x-form-field x-trigger-noedit" readonly="" title="" style="width: 345px;"><img src="/mco/extjs/resources/images/default/s.gif" alt="" class="x-form-trigger x-form-arrow-trigger" id="ext-gen198"></div></div>
我已经尝试过这些方法:
(xpath =
"//input[@id='dependsOnQuestion']/following-sibling::img[@id='ext-gen198']"
和
> css = #dependsOnQuestion ~img "
但是它单击具有图像标签的其他元素
这里是另一个图像标签HTML,当我尝试单击下拉菜单时,该HTML被点赞
<td class="x-grid3-col x-grid3-cell x-grid3-td-edit x-action-col-cell" style="width: 41px;" tabindex="0"><div class="x-grid3-cell-inner x-grid3-col-edit x-unselectable" unselectable="on"><img alt="" src="/mco/images/edit-button.png" class="x-action-col-icon x-action-col-0 "></div></td>
有人可以帮我吗?
尝试以下XPATH
选项。
到元素上的click()
,您必须为elementToBeClickable()
引入WebDriverWait