firefox 下载不弹提示框

编程入门 行业动态 更新时间:2024-10-04 21:24:32

firefox 下载不弹<a href=https://www.elefans.com/category/jswz/34/1771018.html style=提示框"/>

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 下载不弹提示框

本文发布于:2024-02-28 13:35:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1769731.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:提示   firefox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!