Chrome sendChromiumCommand 'Page.setDownloadBehavior' failing - UnsupportedOperationError
See original GitHub issueBug report
- Node Version:
10.16.0
- Protractor Version:
5.4.2
- Angular Version:
8
- Browser(s):
Chrome (headless / normal)
- Operating System and Version
Windows 10
- Your protractor configuration file
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: useHeadlessBrowser ? ["--headless", "--window-size=1920,1080"] : undefined,
useAutomationExtension: false,
// Set download path and avoid prompting for download even though
// this is already the default on Chrome but for completeness
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/pref_names.cc
prefs: {
"download": {
"prompt_for_download": false,
"directory_upgrade": true,
"default_directory": downloadDirectory,
"download_directory": downloadDirectory,
"download_dir": downloadDirectory,
"download_restrictions": 0,
}
}
}
},
Before any tests run I send the below command to Chrome to enable file downloads in headless Chrome
// returns full path
const downloadDirectory = Utils.getTempDirectoryPath();
Utils.log(`Setting Chrome download behaviour to directory ${downloadDirectory}`);
browser.driver.sendChromiumCommand('Page.setDownloadBehavior', {
behavior: 'allow',
downloadPath: downloadDirectory
});
This has stopped working on Chrome 74+ with the error.
UnsupportedOperationError: POST /session/ac771ec3019f7b4c7191e2c9ae2b2056/chromium/send_command
We are unable to run test on Chrome 74 now and cannot get any of our file download tests to work as headless Chrome is unable to download a file with issuing the above command.
Is there any other suggested way to enable file downloads in headless Chrome without issuing the above command?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:13
Top Results From Across the Web
2454 - Headless mode doesn't save file downloads - Monorail
If one uses headless Chrome, the problem is that no file is downloaded. ... From: Task: Custom Command: sendChromiumCommand("Page.setDownloadBehavior" ...
Read more >Chromium/Chrome headless - file download not working?
Nice - this worked for me. A lot of the other answers only talk about sending the Page.setDownloadBehavior command, and not setting the...
Read more >Downloading the files in headless chrome - Katalon Community
Hi I want to download the file in headless chrome. ... setDownloadBehavior"); Map<String, String> params = new HashMap<>(); ...
Read more >protractor Chrome sendChromiumCommand 'Page ... - Git Memory
Chrome sendChromiumCommand 'Page.setDownloadBehavior' failing - UnsupportedOperationError. Open jonsamwell opened this issue 3 years ago • 13 comments ...
Read more >Fix file download errors - Google Chrome Help
Contact the website owner. To help find your downloaded file, learn how to view a downloaded file. Get help with a specific error...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I made it work using this versions:
I launched Chome in headlles way and everything is fine. Actually, it seems like
browser.driver.sendChromiumCommand(...)
configuration is not longer necessary. I deleted it and everything works fine for me.I did not try setting
"w3c":false
but with the versions I mention and deleting the configuration, everything seems to work.Using chromedriver from this link and a chromium binary from this link I was able to use the
driver.execute_cdp_cmd
method.