<input type="submit" class="submit-button" style="white-space:normal" value="hello world!">
这是怎样的HTML提交按钮的作品,在我的HtmlUnit已经得到形式,使用列表:HtmlUnit通过它的值从表单提交按钮?
HtmlForm form = this.page.getForms().get(0);
但现在该网站即时通讯试图负载没有ID或名称上提交按钮,只是一个类&的值。
我试着这样做:
HtmlButton button = (HtmlButton) page.getByXPath("/html/body//form//input[@type='submit' and @value='Hello world!']");
但是,当它加载,我得到这个错误:
Exception in thread "Thread-1" java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlButton
at Web.getButton(Web.java:78)
at java.lang.Thread.run(Unknown Source)
我怎样才能按钮而不ID或价值?