Chrome headless and download default directory

Hi good morning
In a test I’m doing, it works fine in chrome in normal mode, but not in headless mode.
Reading I see that there are problems when trying to download, and you have to set Selenium the preference “download.default_directory”

I am, since Job, doing it without positive results.

This is my configuration

{
“browserName”: “chrome”,
“version”: 83,
“goog:chromeOptions”: {
“prefs”: {
“profile.default_content_settings.popups”: 0,
“download.default_directory”: “C:\Users\\Downloads\”,
“credentials_enable_service”: false,
“profile.password_manager_enabled”: false
}
}
}

Can you help me please?

Hi @here
Chrome headless is downloading the file where the process is launched from, preferences to override this behavior can be found here:

{
  "goog:chromeOptions": {
    "experimentalOptions": {
      "prefs": {
        "download": {
          "default_directory": "C:\\Users\\admin\\Downloads"
        }
      }
    }
  }
}

For macOS:

{
  "goog:chromeOptions": {
    "experimentalOptions": {
      "prefs": {
        "download": {
          "default_directory": "/Users/testproject/Documents"
        }
      }
    }
  }
}

1 Like

Thanks a lot!
I’ll be testing it soon

Hi @nestorr_betacaba,
Glad I could help :slight_smile:
Feel free to contact us anytime.