While developing my free-time project with HtmlUnit I found a strange behaviour when connecting to an 'https' site. The problem was a strange cpu usage, nearly 100% after the end of the method (actually, it lasted until the end of the thread where the scraping was made...).
The problem was due to an incorrect release of Javascript resources after the use by HtmlUnit and was resolved simply adding these 2 statements at the end of the method, disabling Javascript support and closing all connections:
webClient.setJavaScriptEnabled(false)
webClient.closeAllWindows()
Well, this makes sense, and maybe they should be added at the end of every method where HtmlUnit is used...
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento