我有位于表格内的单选按钮,例如:
<tr id="radiofield-1080-inputRow">
<td class="x-form-item-body" id="radiofield-1080-bodyEl" colspan="3">
<input type="button" id="radiofield-1080-inputEl" class="x-form-field" autocomplete="off">
<label id="radiofield-1080-boxLabelEl" class="x-form-cb-label">My Label</label>
</td>
</tr>
我确实通过以下代码找到了输入元素:
xPath = String.format("//tr/td[contains(@id,'%s')][contains(label,'%s')]/label", xType, text);
webElement = webDriver.findElement(By.xpath(xPath));
但isSelected()
或click()
似乎不起作用。你有什么建议吗?