admin管理员组文章数量:1289383
If you inspect / using Chrome on Windows 11, you will see that the page has two forms.
But if you run the following code on Apache Netbeans 25 using JDK 24 and HtmlUnit 4.7.0, you will see that no forms are loaded:
package pima;
import .htmlunit.*;
import .htmlunit.html.*;
public class Pima {
public static void main(String[] args) {
try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX)) {
java.util.logging.Logger.getLogger(".htmlunit").setLevel(java.util.logging.Level.OFF);
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
HtmlPage page = webClient.getPage("/");
webClient.waitForBackgroundJavaScriptStartingBefore(1_000_000);
page = (HtmlPage) page.getEnclosingWindow().getEnclosedPage();
System.out.println("page.asXml() = " + page.asXml());
}
catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
}
}
How do I need to change the above code to load the two forms?
Any suggestions on what I might try will be appreciated.
本文标签: javaHtmlUnit 470 Not Loading FormsStack Overflow
版权声明:本文标题:java - HtmlUnit 4.7.0 Not Loading Forms - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741423154a2377922.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论