Micro Focus QTP (UFT) Forums
How to Delete Cookies... - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to Delete Cookies... (/Thread-How-to-Delete-Cookies)



How to Delete Cookies... - Acharya_silu@yahoo.com - 10-19-2011

Hi,
Can anybody help me how to delete browsing history  before we start our application for test??

I have tried with
Code:
WebUtil.DeleteCookies
but it is not working so i want a script which would delete all cookies

Thanks

Moderator Note: Here are different ways using which you can delete cookies in various browsers.


RE: How to Delete Cookies... - rajpes - 10-19-2011

Code:
SystemUtil.Run "iexplore",,,,0

  WebUtil.DeleteCookies

  SystemUtil.CloseDescendentProcesses



RE: How to Delete Cookies... - jyotikrushna - 10-21-2011

Hi,

You can use the below codes which will delete all cookies, caches and temporary internet files in IE browser:

Code:
Function ClearCookies()
SystemUtil.Run "Control.exe","inetcpl.cpl"
Set objShell = CreateObject("Wscript.Shell")
Do Until Success = True
Success = objShell.AppActivate("Internet Properties")
Wait(1)
Loop
objShell.Sendkeys "%i"
Wait(1)
objShell.Sendkeys "{ENTER}"
Wait(1)
objShell.Sendkeys "%f"
Wait(1)
objShell.Sendkeys "%d"
Wait(1)
objShell.Sendkeys "{ENTER}"
Wait(4)
objShell.Sendkeys "{ENTER}"
End Function
Call ClearCookies()