Java Htmlunit-找不到按钮

Java Htmlunit-找不到按钮,java,htmlunit,Java,Htmlunit,我想单击带有此代码的按钮(“…”表示它太长,无法复制): 问题是按钮为空。代码有什么问题 谢谢。发件人: 公共类HtmlButton扩展了HtmlElement 实现DisabledElement、SubmittableElement、FormFieldWithNameHistory包装器 对于HTML元素“button” 公共类HtmlAnchor扩展HtmleElement HTML的包装器 要素“a” <a title="theTitle" id="123654" onclick=

我想单击带有此代码的按钮(“…”表示它太长,无法复制):

问题是按钮为空。代码有什么问题

谢谢。

发件人:

公共类HtmlButton扩展了HtmlElement
实现DisabledElement、SubmittableElement、FormFieldWithNameHistory包装器

对于HTML元素“button”

公共类HtmlAnchor扩展HtmleElement

HTML的包装器 要素“a”

<a title="theTitle" id="123654" onclick="..." >Press me!</a>
try (final WebClient webClient = new WebClient()) {

        final HtmlPage page = webClient.getPage("http://pathToURL.html");

        HtmlButton button = (HtmlButton) page.getElementById("123654");

        System.out.println(button);
    }