看到很多人在firefox上操作下载窗口用autoit,太麻烦了,提供一种用profile来解决的办法:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.downloadDir", "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);
Webdriver设置Firefox自动下载
使用Firefox配置文件优化下载体验
最新推荐文章于 2021-12-02 10:31:31 发布
本文介绍如何通过配置Firefox的FirefoxProfile来自动化下载过程,包括设置默认下载目录、忽略特定文件类型提示以及批量下载功能,提升用户体验。
6455

被折叠的 条评论
为什么被折叠?



