Possible to change chrome default download path?

I basically trying to open a new tab in already opened chrome browser and then trying to run katalon from starting from giving address to further step. So here I want to change the default chrome download path .
It’s my poc requirement that I have to execute katalon in the next tab of already opened window.

Is there any way we can change path bz as per my knowledge if I try doing with selenium then it changes the path of the chromium not chrome ( correct me if I am wrong)

Plz let me know the possible solution. Thanks

You can configure the default download directory as follows:

1.) Open Project > Settings > Desired Capabilities > Web UI > Chrome:

image

2.) Click the ‘Add’ button, and set the name of the new property to ‘prefs’, the type to ‘Dictionary’:

image

3.) In the value column, click on the ellipses, and set name = ‘download.default_directory’, type = String, value = ‘my/downlaod/directory’:

image

Hope this helps!

6 Likes

Thanks Brandon but I believe it will change the path of chromium not the chrome window which is already open
:frowning:

I’m not sure what you mean. Katalon (and, by extension, Selenium) uses chromedriver to interact with an active instance of the Chrome browser. The steps that I’ve provided above are the equivalent of changing the following setting on your manually-opened Chrome instance:

All of this comes down to the fact that you need a chromedriver that references an active browser instance. Without this, the puppet master has no strings to manipulate the puppet with.

1 Like

well thanks alot @Bradon_Hein lemme try today once I am back at my office and will update you whther it worked for me or not .Thanks for replying !! :slight_smile:

Thanks it worked :blush:

Thanks Brandon! those steps solved my problem downloading Excel files in Google Chrome versión 72 and katalon studio 5.9

It works. Thanks.
How can I set it by code before using WebUI.openBrowser() ?

Hi, is there a way to do this using Script? How will this work if I have dynamic directories since we are a team.

Thanks!

2 Likes

This works absolutely fine but is it possible to change download path in a new window in chrome in already running test case…as in my test case two window opens up and i want to download images in different location for each window.

Can i pass the folder path relative ? e.g I have create download folder on run time and its available in katalon project folder so how can i pass this folder relative path please ?

4 Likes

Not working in the following configuration:
Katalon Version : 6.3.3
Chrome Version 78.0.3904.97

Hi, @Ankita_Raman I am trying to downloading two different kinds of files one is CSV and the 2nd one is PDF I need to keep it separated into two different folders. Can you please suggest to me how it will work.

is it possible to put a relative path?

It would be good if you could use something like …

import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration

GlobalVariable.UploadFilePath = (RunConfiguration.getProjectDir() + ‘/Data Files/’) …

This dynamically gets a filepath for me where I store files to be uploaded, it works locally on my laptop and remotely via TestOps. What we need is some way to dynamically do the reverse of this, i.e. set a path, not get one. If anyone knows how to achieve that I would be more than interested. I don’t see how that could be added to the project settings.

This is what I found that is working for me and not messing up other settings that I already have:

//Set Browser Capabilities.
Map desiredCapabilities = RunConfiguration.getDriverPreferencesProperties("WebUI")
String DownloadFolderPath1=RunConfiguration.getReportFolder()
String DownloadFolderPath=DownloadFolderPath1.replace('/', '\\')
KeywordUtil.logInfo(DownloadFolderPath)
Map prefs = desiredCapabilities.get("prefs")
if (prefs == null) {
	prefs = [:]
}
prefs.put("download.default_directory", DownloadFolderPath)
prefs.put("download_dir", DownloadFolderPath)
prefs.put("download.prompt_for_download", false)
RunConfiguration.setWebDriverPreferencesProperty("prefs", prefs)
WebUI.openBrowser(url)
1 Like