This is a migrated thread and some comments may be shown as answers.

Cookie domain issue

12 Answers 27 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
OUESLATI
Top achievements
Rank 1
OUESLATI asked on 07 Apr 2015, 06:01 PM

Hello,

 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".

 

Thank you.

12 Answers, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 10 Apr 2015, 06:26 AM
Hello Omar,

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.

Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
OUESLATI
Top achievements
Rank 1
answered on 10 Apr 2015, 08:26 AM

Hi,

 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.

 

 

 

0
Ivaylo
Telerik team
answered on 15 Apr 2015, 08:04 AM
Hello Omar,

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.

Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
OUESLATI
Top achievements
Rank 1
answered on 15 Apr 2015, 08:53 AM
 Cookie telerikCookie = new Cookie("cook", "23"); // I tried all options with constructor
                    telerikCookie.Domain = "www.vptest.com"; // here the cookie is not added whenever the domain=".vptest.com" 
                 
                    telerikCookie.Expires = DateTime.MaxValue;
                    _browser.Cookies.SetCookie(telerikCookie);
0
Ivaylo
Telerik team
answered on 17 Apr 2015, 11:31 AM

Hello Omar,

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.

Regards,

Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
OUESLATI
Top achievements
Rank 1
answered on 17 Apr 2015, 11:43 AM

Hello,

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.

 

Regards,

Omar

0
Ivaylo
Telerik team
answered on 21 Apr 2015, 07:55 AM
Hello Omar,

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.


Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
OUESLATI
Top achievements
Rank 1
answered on 23 Apr 2015, 04:58 PM

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 ?

0
Ivaylo
Telerik team
answered on 28 Apr 2015, 10:59 AM
Hello Omar,

We've discovered the issue on our end and I've logged a bug which you can trace and follow using this public URL.

Thank you for your understanding and patience.

Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
OUESLATI
Top achievements
Rank 1
answered on 28 Apr 2015, 11:08 AM
Thank you very much!!
0
OUESLATI
Top achievements
Rank 1
answered on 03 Jul 2015, 03:19 PM

Hi,

 I have noticed that you have updated the test framework library. I am asking if the bug of cookie domain is fixed.

 

Thanks

0
Ivaylo
Telerik team
answered on 06 Jul 2015, 08:24 AM
Hеllo Omar,

Yes, it should be. Please give it a try with our latest release.

Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
OUESLATI
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
OUESLATI
Top achievements
Rank 1
Share this question
or