[英]com.gargoylesoftware.htmlunit.ScriptException: Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher
I am trying to browse http://taxtest.navajocountyaz.gov/Pages/WebForm1.aspx?p=1&apn=10301003B using Java code and the latest release of HTMLUnit (version 2.37.0, which I downloaded from a jar download website along with all its dependencies).我想浏览http://taxtest.navajocountyaz.gov/Pages/WebForm1.aspx?p=1&apn=10301003B使用Java代码和的HtmlUnit(版本2.37.0,最新发布的这是我从一个jar下载网站下载了一起及其所有依赖项)。
final WebClient webClient = new WebClient();
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.setRefreshHandler(new RefreshHandler() {
public void handleRefresh(Page page, URL url, int arg) throws IOException {
System.out.println("handleRefresh");
}
});
HtmlPage page = (HtmlPage) webClient.getPage("http://taxtest.navajocountyaz.gov/Pages/WebForm1.aspx?p=1&apn=10301003B");
The last line of code throws the following exception: com.gargoylesoftware.htmlunit.ScriptException: Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher ( http://taxtest.navajocountyaz.gov/js/bootstrap.js#15 )最后一行代码抛出以下异常:com.gargoylesoftware.htmlunit.ScriptException: Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or later ( http://taxtest.navajocountyaz.gov/js/bootstrap.js#15 )
How do I fix my Java code to be able to browse http://taxtest.navajocountyaz.gov/Pages/WebForm1.aspx?p=1&apn=10301003B ?如何修复我的 Java 代码以便能够浏览http://taxtest.navajocountyaz.gov/Pages/WebForm1.aspx?p=1&apn=10301003B ? I am only interested in extracting some numerical values from the web page.
我只对从网页中提取一些数值感兴趣。
I have posted this as an HTMLUnit issue at https://github.com/HtmlUnit/htmlunit/issues/127 , and RBRI has found a fix for it.我已将此作为 HTMLUnit 问题发布在https://github.com/HtmlUnit/htmlunit/issues/127 上,RBRI 已找到解决方法。 I am posting the fix below:
我在下面发布了修复程序:
Adding the following import statement:添加以下导入语句:
import com.gargoylesoftware.htmlunit.javascript.*;
and adding the following code并添加以下代码
webClient.setJavaScriptErrorListener(new SilentJavaScriptErrorListener());
did fix the problem.确实解决了问题。
Thank you very much RBRI for your help.非常感谢 RBRI 的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.