我将firefox配置文件设置为默认下载所有文件,但是当涉及到图像时,它会弹出一个对话框并询问我保存或查看的天气。我使用的代码如下
var folderName = "temp";
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", "application/all");
_webDriver = new FirefoxDriver(profile);