我嘗試使用該配置文件的設置下載文件在Firefox,但它不工作,你能告訴我什麼,我做錯了,我使用的代碼被髮布這條線爲什麼我無法使用Selenium Webdriver通過Firefox下載文件?
var profile = new FirefoxProfile { EnableNativeEvents = true };
profile.SetPreference("browser.download.folderList", 2);
profile.SetPreference("browser.download.manager.showWhenStarting", false);
profile.SetPreference("browser.download.dir", folderName);
profile.SetPreference("browser.download.downloadDir", folderName);
profile.SetPreference("browser.download.defaultFolder", folderName);
profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "image/jpeg,application/vnd.oasis.opendocument.text,application/vnd.oasis.opendocument.spreadsheet," +
"application/vnd.oasis.opendocument.presentation,application/vnd.oasis.opendocument.graphics," +
"application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet," +
"application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.mozilla.xul+xml," +
"application/vnd.google-earth.kml+xml");
那麼它不起作用? – Arran 2013-02-18 15:51:42
它不會自動下載文件,我仍然在獲取文件下載窗口 – 2013-02-18 15:53:28
作爲臨時的解決方法,我可以使用AutoIT腳本。 – Hemanth 2013-02-19 06:16:26