1.使用python+selenium+chrome 下載多個文件時,則會提示此提示語,不允許的話,則下載的文件不會被保存下來
2.則需要在啓動chrome 的時候加上部分設置
options = webdriver.ChromeOptions()
# options.add_argument('--headless')#非GUI頁面啓動瀏覽器
# options.add_argument('--disable-gpu')
prefs = {'profile.default_content_settings.popups': 0, 'download.default_directory': r'e:\music',"profile.default_content_setting_values.automatic_downloads":1}
options.add_experimental_option('prefs', prefs)
self.driver = webdriver.Chrome(options=options)
參考地址:https://stackoverflow.com/questions/15817328/disable-chrome-download-multiple-files-confirmation