看到很多人在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);

 

相关文章:

  • 2022-02-19
  • 2022-01-08
  • 2021-08-20
  • 2022-01-05
  • 2021-09-17
  • 2021-11-13
  • 2021-12-26
  • 2022-03-01
猜你喜欢
  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2021-06-18
  • 2022-12-23
相关资源
相似解决方案