在我的表单中,我试图通过名称获取按钮。但它没有返回任何值
<td class="_51m- uiOverlayFooterButtons _51mw">
<button value="1" class="_42ft _42fu layerConfirm autofocus uiOverlayButton selected _42g- _42gy" name="__CONFIRM__" type="submit" tabindex="0">Okay
</button>
<button value="1" class="_42ft _42fu layerConfirm uiOverlayButton _42gy" name="__CANCEL__" id="u_0_0" type="submit">Cancel</button>
</td>
我的代码是
HtmlElement dialogForm = dialogPage.getElementById("form");
HtmlElement dialogSubmitButton = dialogForm.getElementsByTagName("button").get(1);
当我尝试使用name返回null时返回值
HtmlElement dialogSubmitButton = dialogForm.getInputsByName("__CONFIRM__")
我如何按名称访问元素?
答案 0 :(得分:3)
它不是
dialogForm.getInputsByName("__CONFIRM__")
它是
dialogForm.getInputByName("__CONFIRM__")