HTMLunit-"Error: [MobX] Proxy not available"

HTMLunit-"Error: [MobX] Proxy not available"

我正在尝试使用 htmlunit 从 javascript 网站获取数据。目前,我只是尝试使用 webClient.getPage 调用该站点,这已经引发异常。

    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]");


}

我遇到以下异常:

    ======= 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)

如我的代码片段所示,我已经应用了在其他线程中观察到的有关使用 htmlunit 时出现 js 错误的选项。我没有使用代理,网站使用的是 cloudflare。这可能是问题所在吗? 提前谢谢你。

[MobX] Proxy not available

看起来 js 代码注意到 HtmlUnit/Rhino 的 javascript 引擎中(当前)缺少代理支持。 通常页面会在开始时进行一些 js 功能检查并报告问题(或者甚至更好地仅使用可用功能)。

请为 HtmlUnit 创建一个问题,如果可能,请包含页面 url 以帮助我们重现该问题。