user241426
user241426

Reputation: 87

HtmlUnit doubts regarding cookies and windows

If the HtmlUnit stores cookies in memory then Will HtmlUnit respond the server with cookies?

When the HtmlUnit session terminates? Will it terminate when i call webclient.closeWindow()?

As acc. to the HtmlUnit docs, WebClient represents a browser, so Is it represent a mutiple-windows browser (like IE7 in which we can open multiple tabs) or represen a single-window browser?

If it represents a multiple-window browser, then does the HttpSession is maintained accross multiple windows of that webclient like real browsers?

Upvotes: 0

Views: 1718

Answers (1)

Pascal Thivent
Pascal Thivent

Reputation: 570595

Not a real answer, but some hints.

If the HtmlUnit stores cookies in memory then Will HtmlUnit respond the server with cookies?

HtmlUnit's cookie policy is to be browser-compatible so I would expect it to do so.

When the HtmlUnit session terminates? Will it terminate when i call webclient.closeWindow()?

I'm not sure about this one. Did you try to test or debug this? Did you look at the source code? Actually, I wonder what should be the expected behavior here.

As acc. to the HtmlUnit docs, WebClient represents a browser, so does it represent a mutiple-windows browser (like IE7 in which we can open multiple tabs) or a single-window browser?

I consider that WebClient represents a single tabbed browser.

If it represents a multiple-window browser, then does the HttpSession is maintained accross multiple windows of that webclient like real browsers?

Note that this behavior is not consistent between browsers and between browser versions: IE6, IE7, IE8, Firefox, Chrome, they all behave (more or less) differently (see Cookies in Firefox and Internet Explorer, or Browsers, processes, cookies and session state, or Session Cookies, sessionStorage, and IE8). So I wouldn't consider that there is a general rule with "real" browsers.

Actually, I think that your best weapons are the source code and your debugger. These questions would be easy to verify IMO.

Upvotes: 1

Related Questions