public void actionVote() {
HtmlForm form = this.page.getForms().get(0);
HtmlInput button = form.getInputByValue("vote");
try {
button.click();
} catch (IOException e) {
e.printStackTrace();
}
}
当我用button.asText()做println时,它给了我提交按钮的正确值,但是当我做button.click时,没有任何反应,就像它没有提交表单一样。Htmlunit按钮不会提交?
我无法使用HtmlButton获取按钮,因为提交按钮没有任何标识或名称。 我也无法使它从HtmlInput HtmlButton。
为什么不提交?错误的元素?
你好user2115021,我编辑过一个麻烦呃你的答案,以便你的代码显示为代码块。 [检查出来](http://meta.stackexchange.com/a/22189/232145),看看你如何做这种格式。它使你的发布代码更容易阅读。 –