Webdriver設置Firefox自動下載


看到很多人在firefox上操作下載窗口用autoit,太麻煩了,提供一種用profile來解決的辦法:

FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.dir", "c:\\data"); profile.setPreference("browser.download.folderList", 2); //browser.download.folderList 設置Firefox的默認 下載 文件夾。0是桌面;1是“我的下載”;2是自定義 profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream, application/vnd.ms-excel, text/csv, application/zip"); driver = new FirefoxDriver(profile);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM