Chrome desired capabilities set up in settings stopped working

Hello everyone! So I have this project since a long time ago, and it was working just fine with setting the capabilities in Katalon settings. I just had “prefs” and “download.default_directory”.

Suddenly (and this happened as well in Edge Chromium but Firefox is working fine) the “Save as” pop up started to appear, so I added “download.prompt_for_download” but it was ignored when under “prefs”, but it works when under “goog:chromeOptions → prefs”.

The thing is, that when I nest both under “goog:chromeOptions → prefs” the pop up doesnt show (which is ok) but katalon/chrome saves the file in the default chrome folder (which is not ok).

If I put “prefs” with “download.default_directory” and also “goog:chromeOptions → prefs” with “download.prompt_for_download”, the “save as” pop up opens up, but the directory in which is going to save the file is okay.

So I don’t know what is going on and why it suddenly the driver stopped working as it was.

I spent hours trying to figure it out and was not able to fix it.

Any help is welcomed.

Recent Chrome/ChromeDriver versions have got stricter about honoring prefs-based download settings, so I guess you are getting that issue.

Katalon supports Chrome preferences in both top-level prefs and goog:chromeOptions -> prefs, but since these settings are not deeply merged, one configuration can overwrite the other, causing some Chrome preferences to be lost unless they are strategically split across both locations.

SO I would suggest you rather than fighting the two merge-prone capability locations, set the download behavior via the Chrome DevTools Protocol after the browser session starts as mentioned below — it bypasses the prefs-merging issue entirely.

WebUI.openBrowser('')

WebDriver driver = DriverFactory.getWebDriver()
if (driver instanceof ChromeDriver) {
    Map<String, Object> params = new HashMap<>()
    params.put("behavior", "allow")
    params.put("downloadPath", "C:\\your\\download\\folder")
    ((ChromeDriver) driver).executeCdpCommand("Page.setDownloadBehavior", params)
}

provide the download navigation

If you’d rather stick with the capabilities-only approach (no code changes), the key is to stop having two competing sources for the same prefs. Remove the top-level prefs entry entirely, and put everything — both download.default_directory and download.prompt_for_download — under a single goog:chromeOptions → prefs object. That way there’s only one object for ChromeDriver to read, instead of two that silently clobber each other.

A couple of things worth double-checking

  • Make sure download.directory_upgrade: true is also set alongside download.default_directory — Chrome sometimes ignores a changed directory unless this flag is present.
  • Use an absolute path for the directory (not a relative one), and if you’re on Windows, escape backslashes (C:\\path\\to\\folder) or use forward slashes — malformed paths are a common reason default_directory silently gets ignored.
  • Double-check there isn’t a duplicate prefs or goog:chromeOptions entry left over anywhere else in your project/profile settings (e.g. a Custom capability or an execution-profile override) — leftover duplicates are what caused the conflict in the first place.

But note this that going forward — Chrome has been progressively tightening how it honors prefs-based download settings across recent releases, so it may break again on a future update. The CDP-based code (Page.setDownloadBehavior) , the code I mentioned above , is the more future-proof fix since it configures the behavior directly through the browser session rather than relying on capability merging.

Solution 1: Use Chrome DevTools Protocol (Recommended)

Instead of fighting the prefs merge issue, set download behavior after the browser starts using CDP:

`WebUI.openBrowser('')`

`WebDriver driver = DriverFactory.getWebDriver()`
**`if`**` (driver `**`instanceof`**` ChromeDriver) {`
`    Map<String, Object> params = `**`new`**` HashMap<>()`
`    params.put("behavior", "allow")`
`    params.put("downloadPath", "C:\\your\\download\\folder")`
`    ((ChromeDriver) driver).executeCdpCommand("Page.setDownloadBehavior", params)`
`}`

This bypasses the prefs-merging issue entirely and works reliably across Chrome versions

Solution 2: Consolidate All Prefs Under goog:chromeOptions.prefs

If you prefer to stick with capabilities, move all prefs into the nested structure:


*`// In Project Settings → Web → Desired Capabilities`*
`"goog:chromeOptions": {`
`    "prefs": {`
`        "download.default_directory": "C:\\your\\download\\folder",`
`        "download.prompt_for_download": false,`
`        "download.directory_upgrade": true,`
`        "safebrowsing.enabled": true`
`    }`
`}`

Remove any top-level prefs block to avoid conflicts

Did you try the suggested solutions?

Please let us know if you have any questions

If resolved then also let us know, which solution worked for you?

Hello, thanks for all your comments, I will be responding case by case.

This didn’t work, it just always work 1 out of the 2 I need, which are, download.prompt_for_download and download.prompt_for_download.

I ended just making a small script that emulates with a js robot the click on the “save as” button, and left the pref with the download path that was working when using this alone.

As mentioned before, this didn’t work either. the download path is only applied when under root->prefs
While the “download.prompt_for_download” only works when under goog:chromeOptions->prefs.

Yes, checked all this, but nothing works and everything looks properly setup.

I am starting to think, it is a bug with the webdriver.

Hi Dinesh, ty for answering.

I tried via script as well, I also tried manually writting on the json file, but default_directory just doesnt work when under goog:chromeOptions.
And if I try to put everything under root->prefs, then default_directory is applied, but prompt_for_download stops working.

I am starting to think it is just a bug on the webdriver.

Would you mind sharing this snippet. I also might need to implement this in near future. Would be great help to have some solution if I get stuck over similar issue.

Thanks in advance.

Thank you for the details

Here it is, 2 things, I do not remember which “imports” this need, you could paste in any AI and ask that.
Also, its probbaly better not to use hardocded waits, but not sure if its possible not to use them. Good luck!

@Keyword
	public saveAsPopupClickSave() {

		//Once the capabilities of Chrome and Edge work again, this must be removed.

		def currentBrowser = identifyBrowser()

		println(currentBrowser)

		if (currentBrowser == "CHROME_DRIVER" || currentBrowser == "EDGE_CHROMIUM_DRIVER") {
			WebUI.delay(5) // esperar que el popup "Guardar como" aparezca

			Robot robot = new Robot()
			robot.setAutoDelay(100)
			robot.keyPress(KeyEvent.VK_ENTER)
			robot.keyRelease(KeyEvent.VK_ENTER)

			WebUI.delay(5) // esperar que el popup se cierre
		}
	}

Noted , thanks for the comment

Thanks for sharing :slight_smile:

Yes, robot class methods work