Forum Discussion

sumit_engineer's avatar
sumit_engineer
Occasional Contributor
11 years ago

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 .
  • 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's avatar
    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"






    • nisgupta's avatar
      nisgupta
      Valued Contributor

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

       

      Please advise

       

      Thanks

      NG

  • hlalumiere's avatar
    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