Disable chrome download multiple files confirmation

后端 未结 9 1383
太阳男子
太阳男子 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:23

    for new chrome (version 46 or newer) this options was changed now your hash must looks like this:

    prefs = {
        'profile' => {
            'default_content_settings' => {'multiple-automatic-downloads' => 1}, #for chrome version olde ~42
            'default_content_setting_values' => {'automatic_downloads' => 1}, #for chrome newer 46
        }
    }
    
    browser = Watir::Browser.new :chrome, options: {prefs: prefs, args: ['--test-type', '--disable-infobars'}
    
    0 讨论(0)
  • 2020-12-02 02:28

    As of Chrome 56.0.2924.87, February 17, 2017, the only preference you need to set (however you set them for your webdriver) is:

    'profile.default_content_setting_values.automatic_downloads': 1
    

    Giving an updated answer because most answers here use outdated preferences or show other preferences that are unnecessary.

    0 讨论(0)
  • 2020-12-02 02:28

    This bug/enhancement has been raised in the chromedriver page at the below URL: http://code.google.com/p/chromedriver/issues/detail?id=130

    Bug/Enhancement Status: Yet to be resolved.

    0 讨论(0)
提交回复
热议问题