How to Fix Download Issues in Chrome Headless Mode?

Patricia Arquette
Release: 2024-11-05 14:41:02
Original
203 people have browsed it

How to Fix Download Issues in Chrome Headless Mode?

How to Download Files in the New Chrome Headless Mode

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>
Copy after login

Chrome 96 through 108:

<code class="python">options = webdriver.ChromeOptions()
options.add_argument("--headless=chrome")</code>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!