提示框"/>
firefox 下载不弹提示框
日子一长,坑了两次,每次几乎半小时 MDDDD
部分copy的 年久都忘记从哪来的了
现在直接copy 代码吧
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 又去找了 下图
上面是正确的
xlsx
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
MIME
.doc application/msword
.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
.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
更多推荐
firefox 下载不弹提示框
发布评论