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).
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 )
How do I fix my Java code to be able to browse 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. 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.