0
我寫了一個腳本,從下面的網站自動下載文件:自動下載停止由於正確的MIME類型不匹配
#Automatically download files to a given folder profile settings
#---------------------------------------------------------------
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.dir'] = 'C:\Documents and Settings\My Documents\userdata\Rubydownloads'
profile['browser.download.folderList'] = 2
profile['browser.helperApps.neverAsk.saveToDisk'] = "application/pdf,application/x-pdf,application/acrobat,application/vnd.pdf,text/pdf,text/x-pdf,image/jpeg,image/pjpeg,image/gif,image/bmp,image/x-windows-bmp,image/tif,image/x-tif,image/tiff,image/x-tiff,application/tif,application/x-tif,application/tiff,application/x-tiff"
profile['browser.download.manager.showWhenStarting'] = false
driver = Selenium::WebDriver.for :firefox, :profile => profile
但我的壞,一些.tif,.tiff and .pdf
仍然錯過而不被下載。可以這樣做,比如說 - 如果在上面的配置文件設置中找不到合適的mime type
,那麼腳本應該將mime
添加到瀏覽器設置中,以繼續下載?
請幫我這裏。