Cookie domain issue

13 posts, 0 answers
  1. OUESLATI
    OUESLATI avatar
    7 posts
    Member since:
    Jul 2013

    Posted 07 Apr 2015 Link to this post

    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.

  2. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 10 Apr 2015 Link to this post

    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
     
  3. OUESLATI
    OUESLATI avatar
    7 posts
    Member since:
    Jul 2013

    Posted 10 Apr 2015 in reply to Ivaylo Link to this post

    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.

     

     

     

  4. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 15 Apr 2015 Link to this post

    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
     
  5. OUESLATI
    OUESLATI avatar
    7 posts
    Member since:
    Jul 2013

    Posted 15 Apr 2015 in reply to Ivaylo Link to this post

     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);
  6. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 17 Apr 2015 Link to this post

    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
     
  7. OUESLATI
    OUESLATI avatar
    7 posts
    Member since:
    Jul 2013

    Posted 17 Apr 2015 in reply to Ivaylo Link to this post

    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

  8. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 21 Apr 2015 Link to this post

    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
     
  9. OUESLATI
    OUESLATI avatar
    7 posts
    Member since:
    Jul 2013

    Posted 23 Apr 2015 Link to this post

    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 ?

  10. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 28 Apr 2015 Link to this post

    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
     
  11. OUESLATI
    OUESLATI avatar
    7 posts
    Member since:
    Jul 2013

    Posted 28 Apr 2015 Link to this post

    Thank you very much!!
  12. OUESLATI
    OUESLATI avatar
    7 posts
    Member since:
    Jul 2013

    Posted 03 Jul 2015 Link to this post

    Hi,

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

     

    Thanks

  13. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 06 Jul 2015 Link to this post

    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
     
Back to Top