firefox 下载不弹提示框

日子一长,坑了两次,每次几乎半小时 MDDDDjavascript

部分copy的 年久都忘记从哪来的了 css

如今直接copy 代码吧html

class AttendanceMonthlyReport(unittest.TestCase):
    def setUp(self):
        fp = browse_driver.FirefoxProfile()
        # 0下载到桌面  1默认下载路径  2 指定目录
        fp.set_preference("browser.download.folderList", 2)
        # False 不显示
        fp.set_preference("browser.download.manager.showWhenStarting", False)
        fp.set_preference("browser.download.dir", test_report_path())
        # 不询问下载路径;后面的参数为要下载页面的Content-type的值
        fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream")
        config = ConfigParser()
        config.read(setting_path())
        self.driver = browse_driver.Firefox(firefox_profile=fp)
        self.driver.maximize_window()
        self.driver.get(config.get('testUrl', 'url'))
        self.username = config.get('projectManager', 'taohui')
        self.password = config.get('projectManager', 'password')
        ws_url = config.get('testUrl', 'ws_test_url')
        self.ws_driver = get_ws_driver(ws_url)

切记 切记 无论下啥都用它 ,我又忘记了,下载excel 又去找了 下图java

上面是正确的 python

xlsx app

application/vnd.openxmlformats-officedocument.spreadsheetml.sheetide

 

MIMEui

.doc     application/mswordurl

.docx   application/vnd.openxmlformats-officedocument.wordprocessingml.documentfirefox

.rtf       application/rtf

.xls     application/vnd.ms-excel application/x-excel

.xlsx    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

.ppt     application/vnd.ms-powerpoint

.pptx    application/vnd.openxmlformats-officedocument.presentationml.presentation

.pps     application/vnd.ms-powerpoint

.ppsx   application/vnd.openxmlformats-officedocument.presentationml.slideshow

.pdf     application/pdf

.swf    application/x-shockwave-flash

.dll      application/x-msdownload

.exe    application/octet-stream

.msi    application/octet-stream

.chm    application/octet-stream

.cab    application/octet-stream

.ocx    application/octet-stream

.rar     application/octet-stream

.tar     application/x-tar

.tgz    application/x-compressed

.zip    application/x-zip-compressed

.z       application/x-compress

.wav   audio/wav

.wma   audio/x-ms-wma

.wmv   video/x-ms-wmv

.mp3 .mp2 .mpe .mpeg .mpg     audio/mpeg

.rm     application/vnd.rn-realmedia

.mid .midi .rmi     audio/mid

.bmp     image/bmp

.gif     image/gif

.png    image/png

.tif .tiff    image/tiff

.jpe .jpeg .jpg     image/jpeg

.txt      text/plain

.xml     text/xml

.html     text/html

.css      text/css

.js        text/javascript

.mht .mhtml   message/rfc822