Hi, when I use htmlunit to load this url
https://view.inews.qq.com/a/20220607A09ES500?tbkt=D&uid=
It throw an exception, and I can not get the full web page html. the exception is below :
Exception class=[net.sourceforge.htmlunit.corejs.javascript.JavaScriptException]
com.gargoylesoftware.htmlunit.ScriptException: Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. (https://mat1.gtimg.com/qqcdn/news-share/js/react.production.min.js#22)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:996)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:590)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:484)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:349)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:923)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:895)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2613)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2606)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeEventListeners(EventListenersContainer.java:342)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeAtTargetListeners(EventListenersContainer.java:379)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventTarget.fireEvent(EventTarget.java:173)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventTarget.dispatchEvent(EventTarget.java:277)
at com.gargoylesoftware.htmlunit.javascript.host.MessagePort$1.lambda$execute$0(MessagePort.java:115)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:590)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:484)
at com.gargoylesoftware.htmlunit.javascript.host.MessagePort$1.execute(MessagePort.java:115)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:1044)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:991)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:590)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:484)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:349)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:923)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:895)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2613)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2606)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeEventListeners(EventListenersContainer.java:342)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeAtTargetListeners(EventListenersContainer.java:379)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventTarget.fireEvent(EventTarget.java:173)
at com.gargoylesoftware.htmlunit.html.DomElement.lambda$fireEvent$0(DomElement.java:1490)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:590)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:484)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:349)
at com.gargoylesoftware.htmlunit.html.DomElement.fireEvent(DomElement.java:1490)
at com.gargoylesoftware.htmlunit.html.HtmlImage.fireEvent(HtmlImage.java:949)
at com.gargoylesoftware.htmlunit.html.HtmlImage.doOnLoad(HtmlImage.java:319)
at com.gargoylesoftware.htmlunit.html.HtmlImage.setAttributeNS(HtmlImage.java:171)
at com.gargoylesoftware.htmlunit.html.DomElement.setAttributeNS(DomElement.java:498)
at com.gargoylesoftware.htmlunit.html.DomElement.setAttribute(DomElement.java:485)
at com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.setAttribute(HTMLElement.java:552)
at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:215)
at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:405)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1876)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:1053)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:89)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:392)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:335)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3916)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:916)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:979)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:590)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:484)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:349)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:923)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:895)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2613)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2606)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeEventListeners(EventListenersContainer.java:342)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeAtTargetListeners(EventListenersContainer.java:379)
at com.gargoylesoftware.htmlunit.javascript.host.event.EventTarget.fireEvent(EventTarget.java:173)
at com.gargoylesoftware.htmlunit.html.HtmlPage.lambda$executeEventHandlersIfNeeded$1(HtmlPage.java:1292)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:590)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:484)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:349)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1292)
at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:322)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:708)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:590)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:508)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:553)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:535)
at org.example.Main.main(Main.java:10)
Caused by: net.sourceforge.htmlunit.corejs.javascript.JavaScriptException: Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. (https://mat1.gtimg.com/qqcdn/news-share/js/react.production.min.js#22)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1300)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:1053)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:89)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:914)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:979)
... 74 more
JavaScriptException value = Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
== CALLING JAVASCRIPT ==
function () {
if (null !== J) {
var a = t();
ta = a + sa;
try {
J(!0, a) ? X.postMessage(null) : (I = !1, J = null);
}
catch (b) {
throw X.postMessage(null), b;
}
} else {
I = !1;
}
}
======= EXCEPTION END ========
And the version of htmlunit which I use is 2.62.0. My test source code is below:
public class Main {
public static void main(String[] args) throws Exception {
WebClient webClient = webClient();
HtmlPage page = webClient.getPage("https://view.inews.qq.com/a/20220607A09ES500?tbkt=D&uid=");
synchronized (page) {
page.wait(5000);
}
System.out.println(page.asXml());
}
private static WebClient webClient() {
WebClient webClient = new WebClient(BrowserVersion.CHROME);
webClient.getOptions().setTimeout(50000);
webClient.getOptions().setRedirectEnabled(true);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.getOptions().setUseInsecureSSL(true);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setCssEnabled(false);
webClient.getCookieManager().setCookiesEnabled(true);
webClient.waitForBackgroundJavaScript(30000);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
return webClient;
}
}
Has anyone encountered a similar problem?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too