HtmlUnit怀疑有关cookie和窗口 [英] HtmlUnit doubts regarding cookies and windows

查看:527
本文介绍了HtmlUnit怀疑有关cookie和窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果HtmlUnit将Cookie存储在内存中,那么HtmlUnit会使用Cookie响应服务器?



当HtmlUnit会话终止时?当我调用webclient.closeWindow()?它会终止。



对于HtmlUnit文档,WebClient代表一个浏览器,因此它代表一个多窗口浏览器(如IE7,我们可以打开多个标签)或表示单窗口浏览器?


解决方案

如果它代表一个多窗口浏览器,那么HttpSession是否保持跨越该webclient的多个窗口像真实浏览器?

不是真正的答案,但有一些提示。


如果HtmlUnit在内存中存储cookie,那么HtmlUnit会使用Cookie响应服务器吗?


HtmlUnit的cookie政策是与浏览器兼容的,所以我希望它能这样做。


当HtmlUnit会话终止时?它会终止当我调用webclient.closeWindow()?


我不知道这一个。你试图测试或调试这个?你看看源代码吗?实际上,我不知道这里应该是什么预期的行为。


对于HtmlUnit文档,WebClient代表一个浏览器,它代表一个多窗口浏览器(如IE7,我们可以打开多个标签)或单窗口浏览器?


我认为 WebClient 表示单个标签式浏览器。


如果它代表一个多窗口浏览器,那么HttpSession是否保持跨越该网络客户端的多个窗口像真实浏览器?


请注意,浏览器和浏览器版本之间的行为不一致:IE6,IE7,IE8,Firefox,Chrome,少)(请参阅 Firefox中的Cookie和Internet Explorer 浏览器,进程,Cookie和会话状态,或会话Cookie,sessionStorage和IE8 )。所以我不会认为有一个真正的浏览器的一般规则。



其实,我认为你最好的武器是源代码和你的调试器。这些问题将很容易验证IMO。


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?

解决方案

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.

这篇关于HtmlUnit怀疑有关cookie和窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆