A java GUI-Less browser, which allows high-level manipulation of web pages, such as filling forms and clicking links; just getPage(url), find a hyperlink, click() and you have all the HTML, JavaScript, and Ajax are automatically processed.
Hi,
I have been using HTMLUnit version 2.15 successfully for some time.
However, a few days ago, my solution stopped working.
For some reason the site is not loaded as it should.
I have already tried to update the version of HTMLUNIT to the latest but unsuccessfully.
cookies, no content ... What is wrong !?
THE CODE....
WebClient webClient = new WebClient();
webClient.getOptions().setUseInsecureSSL(true);
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setAppletEnabled(false);webClient.getOptions().setActiveXNative(false);webClient.getOptions().setGeolocationEnabled(false);webClient.getOptions().setPopupBlockerEnabled(true);webClient.getOptions().setRedirectEnabled(false);//Evita o carregamento desnecessário de paginas webClient.getOptions().setTimeout(TIMEOUT);webClient.getOptions().setPrintContentOnFailingStatusCode(false);webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);webClient.getOptions().setThrowExceptionOnScriptError(false);
Bro, I feel your pain. HTMLUnit can be so finicky sometimes. Have you tried enabling redirects? Setting setRedirectEnabled(false) might be the culprit if the site relies on redirects for session setup. Also, double-check if the site updated their SSL certs or user-agent requirements. Sometimes the simplest fix is just spoofing a real browser user-agent. Hope this helps!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have been using HTMLUnit version 2.15 successfully for some time.
However, a few days ago, my solution stopped working.
For some reason the site is not loaded as it should.
I have already tried to update the version of HTMLUNIT to the latest but unsuccessfully.
cookies, no content ... What is wrong !?
THE CODE....
WebClient webClient = new WebClient();
webClient.getOptions().setUseInsecureSSL(true);
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setJavaScriptEnabled(true);
WebRequest requestSettings = new WebRequest(new URL("http://cadastro.saude.gov.br"), HttpMethod.GET);
Page page = webClient.getPage(requestSettings);
WebResponse response = page.getWebResponse();
Bro, I feel your pain. HTMLUnit can be so finicky sometimes. Have you tried enabling redirects? Setting setRedirectEnabled(false) might be the culprit if the site relies on redirects for session setup. Also, double-check if the site updated their SSL certs or user-agent requirements. Sometimes the simplest fix is just spoofing a real browser user-agent. Hope this helps!