DeleteCookies isn't actually deleting cookies

12 posts, 0 answers
  1. Michael Paterson
    Michael Paterson avatar
    1 posts
    Member since:
    Oct 2009

    Posted 09 Jul 2011 Link to this post

    My authentication utilizes Identity Foundation cookies.  So in order to test multiple users on the same data-driven test, I need to clear the cookies before having the user login again.

    In a coded step I have the following:

    ActiveBrowser.ClearCache(BrowserCacheType.Cookies);
    ActiveBrowser.Cookies.DeleteCookie("mydomain.com");
    
    However, this doesn't seem to be deleting the cookies.
    I added a manual step to ensure that the cookies are gone but they are still there.
    
    If I can't get this to work then the next best thing is to close the browser and open a new one.
    
    
    Thoughts?
  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 11 Jul 2011 Link to this post

    Hi Michael,

    Thank you for evaluating Test Studio. The URL needs to be fully listed, like this:

    ActiveBrowser.Cookies.DeleteCookie("http://www.mydomain.com/")

    Also be sure to list subpages individually, like this:


    You can insert a codeless Clear Cookies step from the "Add" menu, however it will clear ALL cookies from the active browser, unconditionally. Here's what that looks like if you convert it to code:

    // Clear Browser Cookies
    ActiveBrowser.ClearCache(ArtOfTest.WebAii.Core.BrowserCacheType.Cookies);


    Regards,
    Anthony
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  3. Michael Paterson
    Michael Paterson avatar
    1 posts
    Member since:
    Oct 2009

    Posted 11 Jul 2011 Link to this post

    That's interesting.  Your documentation in the code (ie. intellisense) says differently unless I'm misunderstanding:

    See attached picture.

    I updated the code as you specified.  However, the cookies still are not being deleted.
  4. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 11 Jul 2011 Link to this post

    Hello Michael,

    I used your original code in a test that logs into twitter.com. It worked with and without the "http://".

    Does adding the "Clear Cookies" step from the "Add" menu work?

    Please see this thread for a similar discussion. Is your issue browser-specific? Is the site you are testing public for us to reproduce the issue locally? If not, does a public site exhibit similar behavior?

    Greetings,
    Anthony
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  5. Michael Paterson
    Michael Paterson avatar
    1 posts
    Member since:
    Oct 2009

    Posted 13 Jul 2011 Link to this post

    Hi Anthony,

    Adding the Clear Cookies step doesn't seem to work either.  I had a GoToMeeting today with Dan and showed him the issue.  
    I'd prefer not to simply use Clear Cookies because we have some specific requirements around cookies but at this point I'm willing to try anything.

    I've tried a whole slew of things and none of them seem to work.  I'm going to upgrade to the latest release tomorrow or Friday and will try it out again.

    The link you provided appears to be broken.  Our site is not public.  I may be able to get some test credentials for you if you can provide an email address or something that I can send them to.

    Thanks,
    Mike
  6. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 13 Jul 2011 Link to this post

    Hello Michael Paterson,

    I accidentally gave you an internal link; here's the link to the public thread I previously mentioned.

    I agree the Clear Cookies step is not ideal for your application, but I'd like to confirm it works for another public site, like Gmail for example. That way we can isolate that it is your app's cookies specifically that Test Studio is having difficulty with.

    Let me know once you've upgraded and if the issue persists. I will send you an email to the address on file for you to reply with credentials for us to test with.

    Regards,
    Anthony
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  7. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 28 Jul 2011 Link to this post

    Hi Michael Paterson,

    Please direct all communication through the ticketing system and not direct email.

    I did some research on Identity Foundation cookies. It seems they are harder to delete than normal. See here for more information. I also found a way to make the browser delete the cookie by setting it to expired.

    Regards,
    Anthony
    the Telerik team
    Check out the Test Studio roadmap to find out more about the new performance testing functionality coming in our R2 2011 release this September!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  8. John
    John avatar
    6 posts
    Member since:
    Sep 2012

    Posted 20 Mar 2013 Link to this post

    I am having what appears to be the exact same issue.  I've traced the source of the problem down to we are correctly using the secure flag on our cookies. Any cookie with the secure flag set is not being deleted.

    http://en.wikipedia.org/wiki/HTTP_cookie#Secure_and_HttpOnly
  9. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 25 Mar 2013 Link to this post

    Hi John,

    I apologize for the delay getting back to you on this. Which browser (and version) have you noticed this on? Different browser may behave differently. I noticed something similar on another public website (only some cookies are getting deleted) using IE 9 but I didn't narrow it down to which type of cookies were/were not getting deleted. I appreciate the additional information. I have filed a bug on this here.

    Regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  10. John
    John avatar
    6 posts
    Member since:
    Sep 2012

    Posted 26 Mar 2013 Link to this post

    I do not know for sure if the bug exists in all browser extensions, but it absolutely does in chrome. (And I believe it does in FF).  Also it is worth noting that it does not delete cookies with the secure flag set even if you use delete cookie method that takes a specific cookie. (You can enumerate all the cookies just fine, but even every method of deleting seems to fail.)
  11. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 26 Mar 2013 Link to this post

    Hello John,

    Thank you for letting me know which browser you were using. I added that information to the bug report. I do not have a way to work around this problem at this time. All we can do is wait for my development team to investigate what's going on here.

    Kind regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  12. Girish
    Girish avatar
    16 posts
    Member since:
    Jan 2013

    Posted 01 Dec 2015 Link to this post

    is this issue resolved ?  am facing similar issue.. 
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!