如何使用 Selenium 绑定指定 IE11 和边缘浏览器的下载位置

How to spcify the download location for IE11 and edge browsers using Selenium bindings

Selenium C# 绑定能够指定 chrome 下载位置:

var options = new ChromeOptions().AddUserProfilePreference("download.default_directory", "D:\Downloads");

是否存在适合 Edge 和 IE11 的实现?

IE不使用profiles.As这样的,无法用Internet Explorer自动下载文件到指定位置

对于 Edge 尝试以下更改默认下载位置:

EdgeOptions options = new EdgeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_settings.popups", 0);
prefs.put("download.default_directory",
System.getProperty("user.dir")+"\downloads");
prefs.put("download.prompt_for_download", false);
Map<String, Object> edgeOptions = new HashMap<String, Object>();
edgeOptions.put("prefs", prefs);
edgeOptions.put("useAutomationExtension", false);
options.setCapability("ms:edgeChrominum", true);
options.setCapability("ms:edgeOptions", edgeOptions);
WebDriver driver = new EdgeDriver(options);