I am trying to use htmlunit to get data from a javascript website. Currently, I am solely trying to call the site with webClient.getPage, which is already throwing an exception.
public static void main(String[] args) throws Exception {
final WebClient webClient = new WebClient();
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.setJavaScriptTimeout(10000);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.getOptions().setTimeout(10000);
final HtmlPage page1 = webClient.getPage("[my-site-url-here]");
}
I am getting the following exception:
======= EXCEPTION START ========
Exception class=[net.sourceforge.htmlunit.corejs.javascript.JavaScriptException]
com.gargoylesoftware.htmlunit.ScriptException: Error: [MobX] Proxy not available (https://[my-site-here]/static/js/8.107d4023.chunk.js#1)
As seen in my code snippet, I have already applied options observed in other threads regarding js errors when using htmlunit. I am not using a proxy, the website is using cloudflare. Could this be the problem? Thank you in advance.
CodePudding user response:
[MobX] Proxy not available
looks like the js code notices the (currently) missing Proxy support in HtmlUnit/Rhino's javascript engine. Usually pages doing some js feature checks in the beginning and reporting problems (or even better using only the available features).
Please open an issue for HtmlUnit and if possible include the page url to help us to reproduce the problem.
