|
From: RBRi <rb...@us...> - 2019-05-29 18:59:32
|
Without a concret URL it is a bit tricky to analyze the problem.
But two points
1. waitForBackgroundJavaScript / waitForBackgroundJavaScriptStartingBefore are not options. You have to call these methods after every action that might trigger js (e.g. openUrl).
2. do not set the AjaxController if there is no real need.
If you can provide a real complet sample i will have a look.
---
** [bugs:#2016] JavaScript taking way too long time**
**Status:** open
**Group:** 2.35.0
**Labels:** javascript performance long time
**Created:** Wed May 29, 2019 10:15 AM UTC by Abhishek Thakur
**Last Updated:** Wed May 29, 2019 10:25 AM UTC
**Owner:** nobody
Hi There,
I am new to HtmlUnit and I am using this library to login/geo login with postcodes to different websites. I am able to login to websites but it is taking way too long(up to 5 mins). I need to have Javascript enabled to download the forms asyncronously.
I am using below webclient configuration
WebClient webClient = new WebClient(BrowserVersion.CHROME);
WebClientOptions webClientOption = webClient.getOptions();
webClientOption.setCssEnabled(false);
webClientOption.setJavaScriptEnabled(true);
webClientOption.setUseInsecureSSL(true);
webClientOption.setTimeout(30000);
webClientOption.setThrowExceptionOnScriptError(false);
webClientOption.setThrowExceptionOnFailingStatusCode(false);
webClientOption.setUseInsecureSSL(true);
webClientOption.setActiveXNative(true);
webClientOption.setAppletEnabled(true);
webClientOption.setPopupBlockerEnabled(false);
webClientOption.setRedirectEnabled(true);
webClient.waitForBackgroundJavaScript(30000);
webClient.waitForBackgroundJavaScriptStartingBefore(10000);
webClient.setJavaScriptTimeout(30000);
webClient.getCookieManager().setCookiesEnabled(true);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
JavaScriptEngine scriptEngine = (JavaScriptEngine) webClient.getJavaScriptEngine();
HtmlUnitContextFactory factory = scriptEngine.getContextFactory();
Context context = factory.enterContext();
context.setOptimizationLevel(9);
This is happening with almost all the website I am trying to login. Any help in improving the time to run javascript will be greatly appreciated.
Regards,
Abhishek Thakur
---
Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |