Microsoft provides a library for easier Edge testing with Selenium 3.141.0: https://github.com/microsoft/edge-selenium-tools
It fixes this download directory issue, and allows us to remove the workaround introduced in RM-7325.
Related Microsoft forum thread: https://techcommunity.microsoft.com/t5/discussions/set-download-directory-via-webdriver/m-p/1340286/highlight/true#M29776
In EdgeOptions, inside CreateEdgeOptions, we try to set the custom download directory the same way we do in chrome, namely:
edgeOptions.AddUserProfilePreference ("download.default_directory", DownloadDirectory);
This, however, does not seem to work. Edge still chooses the default C:\Users\firstname.lastname\Downloads directory for its downloads. A quick google search revealed that Edge does not support setting the download directory via the user profile preference. Investigations need to be conducted concerning whether setting the download directory via Selenium is possible at all. Perhaps it isn't possible via AddUserProfilePreference but AddArgument?
It is possible to set the download directory via policies: https://docs.microsoft.com/en-us/deployedge/microsoft-edge-policies#downloaddirectory
Downloads are not part of the webdriver protocol (settings).