【发布时间】:2016-10-05 10:48:10
【问题描述】:
我正在尝试选择 Jqgrid 表中的单选按钮。但我找不到它的 XPath。
`table id="list" class="ui-jqgrid-btable" tabindex="0" role="grid" aria-
multiselectable="false" aria-labelledby="gbox_list" style="width: 940px;
display: table;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr class="jqgfirstrow" role="row" style="height:auto">
<td role="gridcell" style="height:0px;width:20px;"></td>
<td role="gridcell" style="height:0px;width:150px;display:none;"></td>
</tr>
<tr id="1" class="ui-widget-content jqgrow ui-row-ltr ui-state-highlight
gridRowSelect" role="row" tabindex="0" style="color: rgb(255, 0, 0);"
aria-selected="true">
<td role="gridcell" style="text-align:center;" title="" aria-
describedby="list_myradio">
<input id="gridRadio" class="gridRadio" name="radio_list" type="radio">
</td>`
【问题讨论】:
-
您可以尝试按id定位元素,而不是使用
XPah:driver.findElement(By.id("elementId"))。其中elementId可能是gridRadio。见the documentation
标签: java selenium-webdriver jqgrid