V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
KevinBu
V2EX  ›  问与答

Selenium+Chromedriver headless 无法下载文件怎么办?

  •  1
     
  •   KevinBu · Dec 11, 2018 · 1306 views
    This topic created in 2699 days ago, the information mentioned may be changed or developed.

    如果不用 headless 则可以下载,使用 headless 则不行,有什么办法解决这个问题? 版本都是目前最新的:Selenium:3.141 Chromedriver:2.45 Chrome: 71.0.3578.80

    配置如下: chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument("--disable-gpu") prefs = {'profile.default_content_settings.popups': 0, 'download.default_directory': 'E:/File/'} chrome_options.add_experimental_option('prefs', prefs) browser = webdriver.Chrome(executable_path='./chromedriver.exe', chrome_options=chrome_options)

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2418 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 02:19 · PVG 10:19 · LAX 19:19 · JFK 22:19
    ♥ Do have faith in what you're doing.