QTP Forums

Full Version: programmatically clear cache
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
Is there a way to programmatically clear cache in QTP ?
I'm dealing with a Webapp, and I use webutil.deletecookies to clear cookies. Anything for clearing cache?

Thanks,
Monika
Hi,
Is it working fine? we also having so many problems regarding
cookies.
Sub DeleteCache()
Dim root
Set root = CreateObject("FPC.Root")
Dim server
Dim cacheDrives
Dim cacheDrive
Dim fso
Set server = root.GetContainingServer()
server.StopFirewallService()
Set cacheDrives = server.CacheDrives
Set fso = CreateObject("Scripting.FileSystemObject")
For Each cacheDrive In cacheDrives
cacheFilePath = CacheDrive.Name & "\urlcache\Dir1.cdat"
fso.DeleteFile cacheFilePath
Next
server.StartFirewallService()
End Sub
Reference URL's