Alex, Thank you so much, I will try it.
On 11月9日, 下午4时56分, "alex.ikhelis" <[EMAIL PROTECTED]> wrote: > Try to output cookies values and you will see how your browser's > document keeps it: > puts ie.document.cookie > or puts tmpcookie > > it should be a string with cookie_name=cookie_value pairs separated > with semicolon. E.g. "SERVER=213" means that there is 1 cookie named > SERVER set to value of "213" in your browser. So as suggested under > the link - when you set the cookie with watir you should explicilty > define the domain for the cookie to be set, e.g. > "cookie_name=cookie_value; Domain=.google.com". It works for us in a > wide range of our test cases across multiple domain names (we have > different domain names for different envs and locales). So in your > case you probable should do something like (a robust example): > ie.document.cookie = tmpcookie + "; Domain=#{your_domain_name}" > This should override all cookie values listed in tmpcookie for > suggested domain session. > > Maybe it's worth looking at your code and the web application you are > working with. But I would suggest the following 2 things first: > 1) try to do scenario you described below - manually, using a specific > browser plugin or something to set cookie. Does it work exactly as you > expect it to do? > 2) sometimes you should restart the browser (after you change cookie > value) to refresh cookie values and let it take effect... E.g. we do > it in our framework each time we clear cache and cookies to have an > independent test or something. > > Alex. > > jnxgn: > > > Thanks a lot, acturelly I searched and read all the posts related to > > cookies in this group, but could not find some hints. > > > what I need is to autopost in a forum by different users, I tried but > > failed the codes below: > > > login with user_name_1 > > tmpcookie = ie.document.cookie > > posting with user_name_1 > > logout and wait for a moment > > ie.document.cookie = tmpcookie > > > the browser remains be logout from the forum, and I expected the > > browser show logged in with the user_name_1 > > > I dont know how to set a cookie for watir, and I could not understand > > the code ie.document.cookie="SERVER=213" in the post of > >http://groups.google.com/group/watir-general/browse_thread/thread/38a... > > > Help and suggestions are highly appreciated. > > > On 11 8 , 4ʱ20 , "alex.ikhelis" <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > I assume you have problems with setting a cookie value? In this case, > > > the first thing I would troubleshoot is: you should explicitly define > > > the domain name for the session you would like to have the cookie > > > value. This link can > > > help:http://groups.google.com/group/watir-general/browse_thread/thread/38a... > > > > Hope it helps. > > > Cheers, Alex. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---