Thursday, November 20, 2008

How to delete cookies through a script?

Cookies are those small files on your computer that store information between sessions or between two login attempts. There are valid reasons where you might need to delete codelete cookiesokies stored on your computer through scripting.

Now, how can we delete cookies through VB Scripting in QTP? This one is a very often repeated question on the testing tools forums. I will first provide a hint here.

  1. You need to write a custom function to do this. IMHO there is no direct way available.
  2. Write a shell script to reach to the cookies file residing in your corresponding folder.
  3. Delete all the files inside that folder.

Please post your script in the comments below. If I don’t get an answer by tomorrow, I will update the post with my script