VB code to clear Chrome Browser history (ALL TIME)

Hi,
I am trying to clear chrome Browser history. (all time). After adding the Open browser activity , I added this URL “chrome://settings/clearBrowserData”. I tried using recorder for click activity. The UiPath Extension is not identifying the UI elements in Chrome. Can anyone share the VBScript code to clear Browser Cache all time and how to invoke it.
Thanks

Hi @chauhan.rachita30,
Extension is able to work with websites but for settings end other “built-in” elements it will not work. You can see that on website extension is blue colored where on settings page it will become gray. You could experiment with Send Hotkey activity or clean history via PowerShell or using invoke of PowerShell.

The extension is not working for google Home Page too…Like the search Text box , I checked everything.

Excluding settings pages the extension should have access to any website even google homepage.

Hi @chauhan.rachita30

You can use this with python code also, which is running perfectly fine.

Code is in the below attached notepad
ClearBrowserHistory.txt (1.2 KB)
file.

Hi Chauhan,

You delete the userProfile>AppData>Local>Google> Chrome > User Data folder. It will clear the user data.

Use this for the same in invoke code activity and make sure to import system.io namespace.

Dim userProfile As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
Dim chromeUserDataPath As String = Path.Combine(userProfile, "AppData", "Local", "Google", "Chrome", "User Data")

Try
    If Directory.Exists(chromeUserDataPath) Then
        Directory.Delete(chromeUserDataPath, True)
        Console.WriteLine("Chrome user data cleared.")
    Else
        Console.WriteLine("Chrome user data directory not found.")
    End If
Catch ex As Exception
    Console.WriteLine("An error occurred: " & ex.Message)
End Try