Попробуйте использовать следующую настройку (Java Bindings):
public WebDriver newDriver() {
try {
EnvironmentVariables vars = SystemEnvironmentVariables.createEnvironmentVariables();
String version = vars.getProperty("webdriver.edgedriver.version");
WebDriverManager.edgedriver().version(version).setup();
EdgeOptions options = new EdgeOptions();
EdgeDriverService edgeDriverService = EdgeDriverService.createDefaultService();
EdgeDriver edgeDriver = new EdgeDriver(edgeDriverService, options);
final String downloadPath = ${your path}
//************* Enable downloading files / set path *******************
Map<String, Object> commandParams = new HashMap<>();
commandParams.put("cmd", "Page.setDownloadBehavior");
Map<String, String> params = new HashMap<>();
params.put("behavior", "allow");
params.put("downloadPath", downloadPath);
commandParams.put("params", params);
ObjectMapper objectMapper = new ObjectMapper();
HttpClient httpClient = HttpClientBuilder.create().build();
String command = objectMapper.writeValueAsString(commandParams);
String u = edgeDriverService.getUrl().toString() + "/session/" + edgeDriver.getSessionId() + "/chromium/send_command";
HttpPost request = new HttpPost(u);
request.addHeader("content-type", "application/json");
request.setEntity(new StringEntity(command));
httpClient.execute(request);
return edgeDriver;
} catch (Exception e) {
throw new Error(e);
}
}
Я смог загрузить файлы по нужному пути, используя этот фрагмент. Источник здесь