I tried everything to download a file in headless chrome but nothing works, I'm using Chrome version 86.0.4240.75 while ChromeDriver version: 86.0.4240.22, I've already tried any solution and none of them worked
download_dir = "/tmp/"
options.add_argument("--start--minimized")
options.add_experimental_option("prefs", {
"download.default_directory": download_dir,
"download.prompt_for_download": False,
})
browser.get(www.download.com)
browser.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command')
params = {'cmd': 'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}}
command_result = browser.execute("send_command", params)
When I try to specify the download directory as well without headless mode it gives me a common download chrome error