From: albu77 <alb...@gm...> - 2017-07-11 09:44:57
|
As I created my webclient factory, I checked for that and I passed asynchrone as a parameter and it is set to true. So it's strange but one thing more to say is that I set the browser version of the webclient to BrowserVersion.FIREFOX_24 . AND LAST BUT NOT LEAST I put also some code I can call +webClient.attendPourJavascriptSaufTimers(pageAffichageLicence, AttentePourJavascript.BEAUCOUP.getTempo()); + webClient.waitForBackgroundJavaScript(AttentePourJavascript.DIX_SECONDES.getTempo()); Two methods which allow any background javascript to execute with a time parameters and in some case the time is long sometime less. the first method kill any anytimer running on the page public int attendPourJavascriptSaufTimers(HtmlPage page,long tempo){ String texteDuScript = ScriptAExecuter.ANNULE_LES_TIMERS.getScript(); Object result = page.executeJavaScript(texteDuScript).getJavaScriptResult(); int retour = this.waitForBackgroundJavaScript(tempo); return retour; } public enum ScriptAExecuter { ANNULE_LES_TIMERS(" limit= 10; \r\n var np, n= setInterval(function(){},100000); \r\n np= Math.max(0, n-limit);\r\n while(n> np){\r\n clearInterval(n--);\r\n }"); final private String script; ScriptAExecuter(String script) { this.script = script; } public String getScript() { return script; } } AS I said it's very far away so I even don't remember the why and how of these code, but What I know it's still in production and running well with htmlunit 2.14. I Hope It could help -- View this message in context: http://htmlunit.10904.n7.nabble.com/Failing-to-load-the-complete-html-content-of-a-page-with-ajax-tp42303p42311.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |