Problem
When automating downloads using Selenium and Chrome 59 in headless mode, the downloads do not start.
Solution
To fix this issue, switch to the new Chrome headless mode using the appropriate headless flag:
Chrome 109 and above:
<code class="python">options = webdriver.ChromeOptions() options.add_argument("--headless=new")</code>
Chrome 96 through 108:
<code class="python">options = webdriver.ChromeOptions() options.add_argument("--headless=chrome")</code>
By enabling the new headless mode, you restore the full functionality of Chrome, including the ability to perform downloads.
The above is the detailed content of How to Fix Download Issues in Chrome Headless Mode?. For more information, please follow other related articles on the PHP Chinese website!