Ask a Question

How to ClearCache and Cookies from Internet Explorer 9

SOLVED
sumit_engineer
Occasional Contributor

How to ClearCache and Cookies from Internet Explorer 9

How to ClearCache and Cookies for Internet Explorer 9 in test complete using vb script as the language .



Please help .
5 REPLIES 5
hlalumiere
Regular Contributor

You can use the following call to clear cache, cookies, passwords, and anything else. If you want to be more selective you will have to change the 255 value to something else. You should be able to find the proper values through Google...



    Set objShell = CreateObject("WScript.Shell")

    objShell.Run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255"






hlalumiere
Regular Contributor

Also here are the equivalents for Chrome and Firefox:



' Clears the Chrome cache, passwords, cookies, etc...

Sub ClearAllChromeStoredInfo

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    

    strAppDataFolder = AQEnvironment.GetEnvironmentVariable("LocalAppData") & "\Google\Chrome\User Data\Default"

    

    Set FilesInFolder = objFSO.GetFolder(strAppDataFolder).Files

    Set FoldersInFolder = objFSO.GetFolder(strAppDataFolder).SubFolders

    

    For Each Folder In FoldersInFolder

        If Not UCase(Folder.Name) = "EXTENSIONS" _

        And Not UCase(Folder.Name) = "EXTENSION STATE" Then

            Folder.Delete True

        End If

    Next

    

    For Each File In FilesInFolder

        If Not UCase(File.Name) = "PREFERENCES" Then File.Delete

    Next

    

End Sub



' Clears the Firefox cache, passwords, cookies, etc...

Sub ClearAllFirefoxStoredInfo

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    

    strLocalAppData = AQEnvironment.GetEnvironmentVariable("LocalAppData") & "\Mozilla\Firefox\Profiles"

    strRoamingAppData = AQEnvironment.GetEnvironmentVariable("AppData") & "\Mozilla\Firefox\Profiles"



    Set FoldersInFolder = objFSO.GetFolder(strLocalAppData).SubFolders

    For Each Folder In FoldersInFolder

        Folder.Delete True

    Next

    

    Set FoldersInFolder = objFSO.GetFolder(strRoamingAppData).SubFolders

    For Each Folder In FoldersInFolder

        Set FilesInFolder = Folder.Files

        For Each File in FilesInFolder

            If Instr(1, File.Name, "sqlite") > 0 Then File.Delete

        Next

    Next

    

End Sub
sumit_engineer
Occasional Contributor

Thanks a lot Hugo  🙂
AlexKaras
Champion Level 3

Command-line versions of Hugo's code:

http://www.catonmat.net/blog/clear-privacy-ie-firefox-opera-chrome-safari/
Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
nisgupta
Valued Contributor

Can Some one provide me how to clear cache and cookies from the browsers using JavaScript ?

 

Please advise

 

Thanks

NG

cancel
Showing results for 
Search instead for 
Did you mean: