Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The application freezes after webClient.getPage() is called #49

Closed
antongrinenko opened this issue Jun 19, 2019 · 2 comments
Closed

The application freezes after webClient.getPage() is called #49

antongrinenko opened this issue Jun 19, 2019 · 2 comments

Comments

@antongrinenko
Copy link

antongrinenko commented Jun 19, 2019

Hi,

Here is a simpe code to reproduce the issue:

public static void main(String[] args) throws IOException {
        final WebClient webClient = new WebClient(BrowserVersion.CHROME);
        webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);
        webClient.getOptions().setJavaScriptEnabled(true);
        webClient.getOptions().setActiveXNative(true);
        webClient.getOptions().setAppletEnabled(false);
        webClient.getOptions().setCssEnabled(true);
        webClient.getOptions().setDoNotTrackEnabled(true);
        webClient.getOptions().setGeolocationEnabled(false);
        webClient.getOptions().setPopupBlockerEnabled(true);
        webClient.getOptions().setPrintContentOnFailingStatusCode(true);
        webClient.getOptions().setThrowExceptionOnScriptError(true);
        webClient.getOptions().setUseInsecureSSL(true);
        webClient.getCookieManager().setCookiesEnabled(true);
        webClient.getOptions().setRedirectEnabled(true);
        HtmlPage page = webClient.getPage("https://new.santehnika-online.ru/product/unitaz_podvesnoy_gustavsberg_estetic_hygienic_flush_chernyy/");
        final String pageAsText = page.asText();
        System.out.println("====>>>> page: " + pageAsText);
        webClient.close();
}

The application freezes at webClient.getPage(...) call. Also I see with jvisualvm that memory grows and this causes OutOfMemory exception.

htmlunit_issue

@antongrinenko
Copy link
Author

Any updates on this?

@rbri
Copy link
Member

rbri commented Jul 25, 2019

Sorry Anton,
but this page works based on obfuscated js code like this

      if (!_0x54d855) {
          _0x550cc5["setCookie"](["*"], "counter", 1);
      } else {
          if (_0x54d855) {
              _0x209bba = _0x550cc5["getCookie"](null, "counter");
          } else {
              _0x550cc5["removeCookie"]();
          }
      }

Did some checks, and it looks like there is an endless loop related to the code above (and the surrounding loop).
But because i'm currently the only developer and i'm having a real job and a real family there is no time to analyze this any deeper. If you are able to point to the js function that works different from real browsers i will try to fix.
Will close this, sorry.

Hope HtmlUnit is useful for you in other cases.

@rbri rbri closed this as completed Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants