How to find the Chrome download path in Java

I am trying to write a test using Webdriver using a Chrome browser, I want to upload some file, when I click the download link, the file is downloaded automatically to download the folder. I was wondering if there is a way to find out what the current path to the download folder is (Win / Linux) Is there any configuration file in which Chrome saves the settings?

Thans

+5
source share
1 answer

Google chrome supports one configuration file for such a custom configuration. The name Preferences , which is in JSON format . Therefore, you should read this file. You will get the current path to the 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 read this file.

Location of this configuration file Linux has
/USER_HOME_FOLDER/.config/chromium/Default/Preferences and on Windows - C: \ Users \ USER_ACCOUNT \ AppData \ Local \ Google \ Chrome \ User Data \ Standard \ Settings

+7
source

All Articles