From: Roberto B. - A. <r.b...@af...> - 2015-08-20 12:10:29
|
Hi Ahmed! When i try to get this page https://www.hapag-lloyd.com/en/tracing/by_container.html , I get an error and the page cannot be displayed HtmlUnit 2.18 and JDK 1.7 This is the code : import com.gargoylesoftware.htmlunit.*; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class HtmlUnitTest { static final WebClient browser; static { browser = new WebClient(BrowserVersion.CHROME); browser.getOptions().setJavaScriptEnabled(true); browser.setAjaxController(new NicelyResynchronizingAjaxController()); CookieManager cookieMan = new CookieManager(); cookieMan = browser.getCookieManager(); cookieMan.setCookiesEnabled(true); browser.getOptions().setRedirectEnabled(true); browser.getOptions().setThrowExceptionOnFailingStatusCode(false); browser.getOptions().setPrintContentOnFailingStatusCode(true); browser.getOptions().setThrowExceptionOnScriptError(false); } public static void main(String[] args) { doTestHapag(); } private static void doTestHapag() { try { HtmlPage page = (HtmlPage) browser.getPage("https://www.hapag-lloyd.com/en/tracing/by_container.html"); browser.waitForBackgroundJavaScript(5000); } catch (Exception e) { System.out.println("EXCEPTION --------------- " + e.toString()); } } } This is the Exception : ago 20, 2015 1:24:11 PM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError Grave: runtimeError: message=[Exceeded maximum stack depth] sourceName=[script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10)] line=[19] lineSource=[null] lineOffset=[0] ago 20, 2015 1:24:11 PM com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException Informazioni: Caught script exception ======= EXCEPTION START ======== Exception class=[net.sourceforge.htmlunit.corejs.javascript.EvaluatorException] com.gargoylesoftware.htmlunit.ScriptException: Exceeded maximum stack depth (script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10)#19) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:865) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:628) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:513) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:747) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:722) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:945) at com.gargoylesoftware.htmlunit.html.HtmlScript.executeInlineScriptIfNeeded(HtmlScript.java:351) at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:411) at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:276) at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:290) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:800) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:757) at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1170) at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1072) at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206) at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:330) at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3126) at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2093) at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:920) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:1040) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:253) at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:199) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:272) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:160) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:476) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:350) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:400) at HtmlUnitTest.doTestHapag(HtmlUnitTest.java:75) at HtmlUnitTest.main(HtmlUnitTest.java:48) Caused by: net.sourceforge.htmlunit.corejs.javascript.EvaluatorException: Exceeded maximum stack depth (script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10)#19) at com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.runtimeError(StrictErrorReporter.java:84) at net.sourceforge.htmlunit.corejs.javascript.Context.reportRuntimeError(Context.java:1090) at net.sourceforge.htmlunit.corejs.javascript.Context.reportRuntimeError(Context.java:1137) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.initFrame(Interpreter.java:2887) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1448) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798) at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:310) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3286) at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:738) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:850) ... 33 more Enclosed exception: net.sourceforge.htmlunit.corejs.javascript.EvaluatorException: Exceeded maximum stack depth (script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10)#19) at com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.runtimeError(StrictErrorReporter.java:84) at net.sourceforge.htmlunit.corejs.javascript.Context.reportRuntimeError(Context.java:1090) at net.sourceforge.htmlunit.corejs.javascript.Context.reportRuntimeError(Context.java:1137) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.initFrame(Interpreter.java:2887) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1448) at script.ii(script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10):19) at script.ii(script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10):19) at script.ii(script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10):19) at script.ii(script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10):19) .................................... at script.ii(script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10):19) at script(script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10):19) at script(script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10):15) at script(script in https://www.hapag-lloyd.com/en/tracing/by_container.html from (8, 31) to (25, 10):10) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798) at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:310) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3286) at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:738) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:850) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:628) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:513) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:747) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:722) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:945) at com.gargoylesoftware.htmlunit.html.HtmlScript.executeInlineScriptIfNeeded(HtmlScript.java:351) at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:411) at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:276) at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:290) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:800) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:757) at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1170) at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1072) at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206) at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:330) at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3126) at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2093) at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:920) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:1040) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:253) at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:199) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:272) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:160) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:476) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:350) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:400) at HtmlUnitTest.doTestHapag(HtmlUnitTest.java:75) at HtmlUnitTest.main(HtmlUnitTest.java:48) ======= EXCEPTION END ======== Regards, Roberto. |