Disable chrome download multiple files confirmation

后端 未结 9 1416
太阳男子
太阳男子 2020-12-02 01:57

I developed a crawler with ruby watir-webdriver that downloads some files from a page. My problem is that when I click to download the second file, Chrome opens a bar in the

9条回答
  •  再見小時候
    2020-12-02 02:08

    Java solution:

    cap = DesiredCapabilities.chrome();
    ChromeOptions options = new ChromeOptions();
    Map prefs = new HashMap<>();
    Map content_setting = new HashMap <>();
    
    content_setting.put("multiple-automatic-downloads",1);
    
    prefs.put("download.prompt_for_download", "false");
    prefs.put("profile.default_content_settings", content_setting);
    
    options.setExperimentalOption("prefs", prefs);
    cap.setCapability(ChromeOptions.CAPABILITY, options);
    

提交回复
热议问题