Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find Chrome download path in Java

I'm trying to write a test with Webdriver by using Chrome browser, I want to download some file, when I click download link, the file is being downloaded automatically to download folder. I was wondering if there is some way to find out what is the current path of the download folder (Win / Linux) Is there some configuration file where Chrome keep it settings ?

Thans

like image 808
Igal Avatar asked Aug 26 '13 06:08

Igal


People also ask

Where is Chrome download location?

Default download locations If you didn't change your default download location, then Google Chrome downloads files to the following locations: Windows 10, 8, 7 and Vista: \Users\<username>\Downloads. Mac: /Users/<username>/Downloads. Linux: /home/<username>/Downloads.


1 Answers

Google chrome is maintaining one config file for such custom configuration Named as Preferences which is in JSON format.So you have to read this file.You will get the current path of download folder from this file.

"download": {
      "default_directory": "CURRENT_PATH_OF_YOUR_DOWNLOAD_FOLDER",
      "directory_upgrade": true,
      "extensions_to_open": "",
      "prompt_for_download": false
 },

Parsing JSON File Java This will help you to read that file.

Location of this configuration file In Linux is
/USER_HOME_FOLDER/.config/chromium/Default/Preferences and in Windows is
C:\Users\USER_ACCOUNT\AppData\Local\Google\Chrome\User Data\Default\Preferences

like image 116
Satyam Koyani Avatar answered Sep 18 '22 12:09

Satyam Koyani