"How can I retrieve the default downloads path of Chrome using UiPath?"

“How can I obtain the default downloads path of Chrome using UiPath without the need to interact with the web or utilize PowerShell?”

@sheikhzainulabideen444

Use the Assign activity to set a variable for the Chrome Registry key and the default downloads path.

chromeKey` (String): The Registry key for Google Chrome settings.

downloadPath` (String): A variable to store the default downloads path.

Example:

Assign chromeKey = “HKEY_CURRENT_USER\Software\Google\Chrome\PreferenceMACs\default”
Assign downloadPath = “”

Use the “Invoke Method” activity to read the Registry key. Drag and drop the “Invoke Method” activity onto your workflow.
For the Target Object specify Microsoft.Win32.Registry
For the Method Name choose GetValue.
Use this

Assign key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(chromeKey)

OR
Follow this steps:

Assign chromeKey to the Chrome Registry key.
Assign downloadPath to an empty string.
Use “Invoke Method” to read the Registry key value.
Assign downloadPath to the extracted value.
Display or log the downloadPath variable.

Cheers…!

You can read the file %localappdata%\Google\Chrome\User Data\Default\Preferences and deserialize it to json. If it contains download.default_directory, the user has changed the default download directory and the value can be read. If not, the Chrome default is used.

"download": {
  "default_directory": "C:\\Users\\[UserName]\\Downloads",
  "directory_upgrade": true,
  "extensions_to_open": ""
}

Not very clear what you want.

Default path for downloads in chrome is always:
\Users<username>\Downloads

But if you want path for latest file that you downloaded then this expression would get you the latest file.

Just replace the folder path at yourfolder_path & use assign activity for below expression.

str_filepath = Directory.GetFiles(yourfolder_path,“*.txt”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0) Cheers

Check this thread for discussions and solution as well

Cheers @sheikhzainulabideen444