|
From: RBRi <rb...@us...> - 2019-04-10 17:44:24
|
- **status**: open --> closed
- **assigned_to**: RBRi
- **Comment**:
Sorry, this is no longer reproducible.
---
** [bugs:#1796] HTMLUnit lookup returns request unsuccessful with JS off**
**Status:** closed
**Group:** 2.22
**Created:** Sun Jun 05, 2016 07:00 PM UTC by Manny Gites
**Last Updated:** Mon Jun 06, 2016 09:25 PM UTC
**Owner:** RBRi
If I run the following code (see that JS enabled is true), the page usually loads. However, if I turn off JS enabled, the lookup fails. Note that I decided to turn off JS in my code b/c I'm writing a crawler and there are lots of sites that I run into that cause HTMLUnit to stall. I just need the page source for my crawler to index.
public static void main(String[] args) throws Exception {
java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(java.util.logging.Level.OFF);
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
WebClient webClient = new WebClient(BrowserVersion.BEST_SUPPORTED);
webClient.getOptions().setJavaScriptEnabled(true); /*test fails if false*/
webClient.getOptions().setRedirectEnabled(true);
webClient.getOptions().setCssEnabled(true);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setUseInsecureSSL(true);
webClient.getOptions().setHistorySizeLimit(1);
webClient.getOptions().setPopupBlockerEnabled(true);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.setJavaScriptTimeout(2147483647);
webClient.setCssErrorHandler(new SilentCssErrorHandler());
webClient.setRefreshHandler(new ThreadedRefreshHandler());
webClient.getCookieManager().setCookiesEnabled(true);
HtmlPage pg = webClient.getPage("http://www.justbatreviews.com");
System.out.println(pg.asText());
webClient.close();
webClient.getCookieManager().clearCookies();
}
---
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. |