看到很多人在firefox上操作下载窗口用autoit,太麻烦了,提供一种用profile来解决的办法:
FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.downloadDir", "c:\\data"); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream, application/vnd.ms-excel, text/csv, application/zip"); driver = new FirefoxDriver(profile);