How to delete browser cookies (Internet Explorer)

Class library usage, coding and language questions.
akommalapati
Posts: 21
Joined: Wed Dec 07, 2011 2:54 pm
Location: India

How to delete browser cookies (Internet Explorer)

Post by akommalapati » Mon Jan 09, 2012 2:56 pm

Hi,
Can u please let me know the code for deleting cookies.

Thanks
Ajay

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to delete browser cookies (Internet Explorer)

Post by Support Team » Mon Jan 09, 2012 5:18 pm

Hi,

Please take a look to following post
http://stackoverflow.com/questions/1611 ... ete-cookie

I've used Google to find this link.

Regards,
Peter
Ranorex Team
.
Image

timhunt
Posts: 1
Joined: Wed Sep 18, 2013 5:54 pm

Re: How to delete browser cookies (Internet Explorer)

Post by timhunt » Wed Sep 18, 2013 5:56 pm

Good grief! Don't you have a better answer than that? I have to manually implement a different hack to clear cookies in each browser. Wound't a standard clear cookies action provided by you be better?

(Well, obviously it would. I guess what you are saying is that it does not exist.)

Alena
Posts: 20
Joined: Fri Feb 22, 2013 7:50 pm

Re: How to delete browser cookies (Internet Explorer)

Post by Alena » Mon Sep 23, 2013 8:28 pm

Hi,

is it possible now to implement a new action/function for clearing cache/cookies so that I can do it by a single line of code for each of 4 browsers instead of creating 4 pages of code?

I'm sure most of Rx users test web-sites and have to use this functionality pretty often.

Thanks,
Alena.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: How to delete browser cookies (Internet Explorer)

Post by krstcs » Tue Sep 24, 2013 2:07 pm

Each browser stores and manipulates cookies differently. Some (Safari, Chrome) DO NOT ALLOW Ranorex to manipulate certain areas of the browser, so it would be almost impossible for Ranorex to find a uniform, consistent way to do it.

You could implement your own lower-level clean-up routine by just deleting the cookies from the OS, since you should know where they are depending on your installation. Since Ranorex is all .NET, it's not hard to do. Then just call that routine when you run the tests that need cookies cleaned up.

And doing that is NOT a hack, it's what we, as test automation developers, are supposed to be doing, using the great tools that Ranorex and .NET provide...
Shortcuts usually aren't...