0

I have test in which I get page (with help of the htmlUnit) and I may print content of that page, i.e. htmlUnit works correct and fine load my page, but I need to see how that page load all resources (css, js and other resources).

My HTTP sniff(charles) does not catch loading of page. What may be wrong in this case?

rtruszk
  • 3,902
  • 13
  • 36
  • 53
user3569530
  • 193
  • 2
  • 4
  • 13

3 Answers3

0

My http sniff(charles) does not catch loading of page. What is may be wrong in this case?

This may happen when you're trying to sniff on local traffic. See Localhost traffic doesn't appear in Charles for workarounds.

0

This is desicion final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_10, "myproxyserver", myProxyPort);

user3569530
  • 193
  • 2
  • 4
  • 13
0

HtmlUnit requires his own proxy setup.

  1. When using Charles the proxy configuration of reals browsers (IE, FF) will be adapted automatically from Charles. But Charles does not offer this convenience for HtmlUnit.
  2. Keep in mind that HtmlUnit does not use the java proxy settings. You have to configure this when starting your WebClient; e.g. new WebClient(BrowserVersion.FIREFOX_31, "localhost", 8888);
  3. Like real browsers, you have additional options to configure hosts to bypass. For doing this you can create a new ProxyConfig; addHostsToProxBypass and than us webClient.getOptions.setProxyConfig to activate your new ProxyConfig.
  4. And finally there is another option. HtmlUnit internally uses HttpClient. This implies, that you can enable HttpClient wire log (via 'org.apache.http.wire') to see all transferred info in your log.
RBRi
  • 2,704
  • 2
  • 11
  • 14