I am working on a project totally focused on managing cookies (getting and setting cookies from browsers). I am using the latest version of test framework "Telerik test studio automation 2013.2.1519.1" under firefox. All setups are OK.
So the problem consists in the domain of a cookie: I can't add a cookie with a domain ".example.com" in the browser, thus all dervied urls (example.com, art.example.com,www.example.com, any.other.example.com) will read that cookie.
The cookie domain cases that succeded are : "www.example.com", "example.com", "http://www.example.com"
But, whenever I add a cookie with "www.example.com", in the browser the cookie will be added "www.example.com" not ".example.com".
My main goal is to have all cookies loaded in the browser with ".example.com".
12 Answers, 1 is accepted
I don't think this is Test Studio limitation but rather .Net limitation or browser limitation. I am afraid this issue is not under the scope of our product.
Thank you for your understanding.
Thank you for your attention. In fact, within my project I am using two UI frameworks Selenium and Telerik. Selenium handles ".example.com" domain and yours not. And this is required by browsers like firefox and chrome not IE and safari. So I think It is a browser cookie domain requirements not handled by Telerik.
Please provide us with a sample example on how you are setting the cookie so we can take a look.
Looking forward to hearing from you.
telerikCookie.Domain = "www.vptest.com"; // here the cookie is not added whenever the domain=".vptest.com"
telerikCookie.Expires = DateTime.MaxValue;
Please take a look at this article which explains the browser's behavior.
This suggests the workaround is to simply set the domain to "vptest.com" with no leading dot. Both browsers and TestStudio should properly send the cookie to anything host that exactly matches vptest.com OR any host that ends with .vptest.com.
Thank you for your response.
Yes, this is IE behavior and I have no problem in managing cookies with it either under Telerik or Selenium. However, firefox and chrome handle cookies otherwise. I already tried "vptest.com" domain against them and unfortunately it didn't work.
Please take a look at Browsers behavior in handling cookie domain , thus you will better understand my point.
It is not clear for us what you mean when you say “Firefox and Chrome handle cookies otherwise.” If you load http://debugtheweb.com/test/cookieinherit.aspx in IE, Chrome, and Firefox, you’ll see that the cookie with a domain attribute with no leading dot is treated identically to a cookie with a domain attribute with a leading dot.
I meant Firefox and chrome do care about the cookie domain however IE does not. That's why I don't have a problem with IE.
Using Telerik, whenever I want to add a cookie with a domain in this format ".example.com" (a leading dot domain) it does not get injected n firefox or chrome. Only cookies with no leading dot domain are successfully injected into the browser .
So to conclude, how to add a cookie with a leading dot domain using Telerik ?
I have noticed that you have updated the test framework library. I am asking if the bug of cookie domain is fixed.
Yes, it should be. Please give it a try with our latest release.