java - 无法使用 Selenium Java 单击单选按钮
问题描述
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="radioTypeTable" class="radioTable">
<tbody><tr id="transactionType">
<td align="left" style="width:12px;"><input type="radio" name="preliminaryApplication_TransactionType" tabindex="200" value="1" checked="checked" onclick="clearFSProgramsOnChangeOfTransType();resetDlrPreferredFs();changeTransactionType(this);" id="preliminaryApplication_TransactionType_1" class=""></td>
<td align="left" class="transtypeLabel"><strong><label id="preliminaryApplication_TransactionType_1_label" for="preliminaryApplication_TransactionType_1">Option1</label></strong></td><td style="width:5%;"> </td>
<td align="left" style="width:12px;"><input type="radio" name="preliminaryApplication_TransactionType" tabindex="200" value="2" onclick="clearFSProgramsOnChangeOfTransType();resetDlrPreferredFs();changeTransactionType(this);" id="preliminaryApplication_TransactionType_2"></td>
<td align="left" class="transtypeLabel"><strong><label id="preliminaryApplication_TransactionType_2_label" for="preliminaryApplication_TransactionType_2">Option2</label></strong></td><td style="width:5%;"> </td>
</tr>
<tr>
<td align="left" colspan="10">
</td>
</tr>
</tbody></table>
我有一个页面,其中包含多个单选按钮,默认情况下选择一个特定的单选按钮开始。在尝试单击任何其他 Radio 时,它根本不起作用,并且移动得更远而不会失败。到目前为止我尝试过的事情:
动作类“双击”
Actions actions = new Actions(driver);
actions.doubleClick(element).perform();
动作类“moveToElement”,然后单击
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.click();
actions.build().perform();
Javascript 执行器点击
((JavascriptExecutor) driver).executeScript("arguments[0].click();", element);
甚至尝试在while循环中单击
到目前为止没有任何效果。此按钮之前和之后页面上的所有其他内容都可以正常工作。我也在寻找任何可能的 iFrame。单击按钮时,我可以看到按钮变为蓝色。但是,点击不粘。我也给予了足够的隐式和显式等待来尝试。我还检查了按钮是否可见。有什么建议么。
解决方案
推荐阅读
- php - 输入字段中的日期时间值
- javascript - 在jQuery中上传图像后如何在输入字段中显示图像文件名
- python - 动画情节“列表”对象没有属性“set_data”,即使我遵循针对其他类似问题的建议?
- api - 产品的 BigCommerce 和 Myob API 集成
- docker - 是否可以附加到正在运行的 docker build 命令
- android - 有谁知道与 Android 兼容的 Unity 2018 轮廓着色器?
- html - mouseleave 被触发
- javascript - 在 MVC 项目中使用 Javascript Websockets
- python-3.7 - Razorpay 签名验证在 python 中失败
- java - 无法将文件解压缩到 /storage/emulated/0