HtmlUnit / htmlunit

HtmlUnit is a "GUI-Less browser for Java programs".
https://www.htmlunit.org
Apache License 2.0
872 stars 171 forks source link

Html Unit crash when opening skribbl.io #181

Closed thedonatic closed 4 years ago

thedonatic commented 4 years ago

I tried to get the website "https://skribbl.io/", but the getPage() methode crashed.

public SkribblIoConnector() { try (final WebClient webClient = new WebClient()) { page = webClient.getPage("https://skribbl.io/"); }catch(Exception e) { e.printStackTrace(); } }

ERROR: t c=()=>{if(b){var d=Ls(Gs(b),a.B.google_ad_client,b.location.hostname,Gh(a.B).eids||[]);X("ama_stats",d,1)}};"complete"===b.document.readyState?q.setTimeout(c,1E3):me(b,"load",()=>{q.setTimeout(c,1E3)})}},Px=a=>{a&&!Gh(a).host_pinged_back&&(Gh(a).host_pinged_back=!0,X("abg_host",{host:a.location.host},.01))};{(()=>{var b=[uu,tu,Uj,bj];Wi.l=c=>{Ka(b,d=>{d(c)});Zi(c);$i(c)}})();const a=q.google_sl_win||q;a.google_sa_impl||(a.google_sa_impl=Cx,Vw(Tw(a)),a.google_process_slots&&a.google_process_slots())};}).call(this,window,document,location)

======= EXCEPTION END ======== ======= EXCEPTION END ========

java.lang.RuntimeException: com.gargoylesoftware.htmlunit.ScriptException: Wrapped com.gargoylesoftware.htmlunit.ScriptException: syntax error (https://pagead2.googlesyndication.com/pagead/js/r20200622/r20190131/show_ads_impl_fy2019.js#15) at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:321) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:646) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:451) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:368) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:520) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:501) at de.donatic.util.network.SkribblIoConnector.(SkribblIoConnector.java:16) at de.donatic.Main.main(Main.java:11) Caused by: com.gargoylesoftware.htmlunit.ScriptException: Wrapped com.gargoylesoftware.htmlunit.ScriptException: syntax error (https://pagead2.googlesyndication.com/pagead/js/r20200622/r20190131/show_ads_impl_fy2019.js#15) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:891) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:624) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:537) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:354) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:771) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:747) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:103) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1017) at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:361) at com.gargoylesoftware.htmlunit.html.HtmlScript$2.execute(HtmlScript.java:234) at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:314) ... 7 more Caused by: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped com.gargoylesoftware.htmlunit.ScriptException: syntax error (https://pagead2.googlesyndication.com/pagead/js/r20200622/r20190131/show_ads_impl_fy2019.js#15) at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:2003) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:944) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$200(JavaScriptEngine.java:103) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:886) ... 17 more Caused by: com.gargoylesoftware.htmlunit.ScriptException: syntax error (https://pagead2.googlesyndication.com/pagead/js/r20200622/r20190131/show_ads_impl_fy2019.js#15) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:891) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:624) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:537) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:354) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:722) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:688) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:103) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1117) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:997) at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:361) at com.gargoylesoftware.htmlunit.html.HtmlScript$2.execute(HtmlScript.java:234) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:939) ... 19 more Caused by: net.sourceforge.htmlunit.corejs.javascript.EvaluatorException: syntax error (https://pagead2.googlesyndication.com/pagead/js/r20200622/r20190131/show_ads_impl_fy2019.js#15) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory$HtmlUnitErrorReporter.error(HtmlUnitContextFactory.java:438) at net.sourceforge.htmlunit.corejs.javascript.Parser.addError(Parser.java:258) at net.sourceforge.htmlunit.corejs.javascript.Parser.reportError(Parser.java:326) at net.sourceforge.htmlunit.corejs.javascript.Parser.reportError(Parser.java:313) at net.sourceforge.htmlunit.corejs.javascript.Parser.reportError(Parser.java:306) at net.sourceforge.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3201) at net.sourceforge.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2743) at net.sourceforge.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2637) at net.sourceforge.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2558) at net.sourceforge.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2542) at net.sourceforge.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2523) at net.sourceforge.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2498) at net.sourceforge.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2470) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2459) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2448) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2437) at net.sourceforge.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2426) at net.sourceforge.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2415) at net.sourceforge.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2379) at net.sourceforge.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2335) at net.sourceforge.htmlunit.corejs.javascript.Parser.expr(Parser.java:2314) at net.sourceforge.htmlunit.corejs.javascript.Parser.forLoopInit(Parser.java:1627) at net.sourceforge.htmlunit.corejs.javascript.Parser.forLoop(Parser.java:1531) at net.sourceforge.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1190) at net.sourceforge.htmlunit.corejs.javascript.Parser.statement(Parser.java:1127) at net.sourceforge.htmlunit.corejs.javascript.Parser.parseFunctionBody(Parser.java:764) at net.sourceforge.htmlunit.corejs.javascript.Parser.function(Parser.java:934) at net.sourceforge.htmlunit.corejs.javascript.Parser.parseFunctionBody(Parser.java:761) at net.sourceforge.htmlunit.corejs.javascript.Parser.function(Parser.java:934) at net.sourceforge.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3111) at net.sourceforge.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2743) at net.sourceforge.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2637) at net.sourceforge.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2558) at net.sourceforge.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2542) at net.sourceforge.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2523) at net.sourceforge.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2498) at net.sourceforge.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2470) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2459) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2448) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2437) at net.sourceforge.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2426) at net.sourceforge.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2415) at net.sourceforge.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2379) at net.sourceforge.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2335) at net.sourceforge.htmlunit.corejs.javascript.Parser.expr(Parser.java:2314) at net.sourceforge.htmlunit.corejs.javascript.Parser.parenExpr(Parser.java:3216) at net.sourceforge.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3127) at net.sourceforge.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2743) at net.sourceforge.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2637) at net.sourceforge.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2558) at net.sourceforge.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2542) at net.sourceforge.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2523) at net.sourceforge.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2498) at net.sourceforge.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2470) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2459) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2448) at net.sourceforge.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2437) at net.sourceforge.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2426) at net.sourceforge.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2415) at net.sourceforge.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2379) at net.sourceforge.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2335) at net.sourceforge.htmlunit.corejs.javascript.Parser.expr(Parser.java:2314) at net.sourceforge.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1273) at net.sourceforge.htmlunit.corejs.javascript.Parser.statement(Parser.java:1127) at net.sourceforge.htmlunit.corejs.javascript.Parser.parse(Parser.java:664) at net.sourceforge.htmlunit.corejs.javascript.Parser.parse(Parser.java:583) at net.sourceforge.htmlunit.corejs.javascript.Context.parse(Context.java:2637) at net.sourceforge.htmlunit.corejs.javascript.Context.compileImpl(Context.java:2586) at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1590) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:224) at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1579) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$1.doRun(JavaScriptEngine.java:713) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:876) ... 30 more

thedonatic commented 4 years ago

Fixed by setting the option ThrowExceptionOnScriptError of the webclient to false.

webClient.getOptions().setThrowExceptionOnScriptError(false);