HtmlUnit 对 cookie 和 windows 的疑问
如果 HtmlUnit 在内存中存储 cookie,那么 HtmlUnit 会用 cookie 响应服务器吗?
HtmlUnit 会话何时终止?当我调用 webclient.closeWindow() 时它会终止吗?
按照。对于HtmlUnit文档,WebClient代表一个浏览器,那么它代表一个多窗口浏览器(例如IE7,我们可以在其中打开多个选项卡)还是代表一个单窗口浏览器?
如果它代表一个多窗口浏览器,那么 HttpSession 是否像真正的浏览器一样在该 Web 客户端的多个窗口中维护?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不是真正的答案,而是一些提示。
HtmlUnit 的 cookie 策略是与浏览器兼容的,所以我希望它能够这样做。
我对此不太确定。您是否尝试过测试或调试这个?你看过源代码吗?实际上,我想知道这里的预期行为应该是什么。
我认为
WebClient
代表单个选项卡式浏览器。请注意,这种行为在浏览器之间和浏览器版本之间并不一致:IE6、IE7、IE8、Firefox、Chrome,它们的行为(或多或少)不同(请参阅 Firefox 和 Internet Explorer 中的 Cookie,或 浏览器、进程、cookie 和会话状态 或 会话 Cookie、sessionStorage 和 IE8< /a>)。所以我不认为“真正的”浏览器有一般规则。
实际上,我认为最好的武器是源代码和调试器。在我看来,这些问题很容易验证。
Not a real answer, but some hints.
HtmlUnit's cookie policy is to be browser-compatible so I would expect it to do so.
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.
I consider that
WebClient
represents a single tabbed browser.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.