Description
What happened?
I am using AddUserProfilePreference
method of EdgeOptions
class to change the name of the profile which by default is Profile 1, Profile 2 etc.
Here is how I am launching the browser.
EdgeOptions options = new EdgeOptions();
options.AddArgument(@$"user-data-dir=directory-path");
options.AddUserProfilePreference("profile.name", "My Profile Name");
var driver = new EdgeDriver(options);
and it is working perfectly fine until I pass the profile-directory option to use different directory.
options.AddArgument(@$"profile-directory=my-directory}");
if I pass the profile-directory option it still only changes the preference of the default profile and not the one I am using.
also if I don't mention profile name in preference when launching browser for the first time, it won't work if I mention it next time. have to delete the directory and re run the code for preferred profile name to work.
How can we reproduce the issue?
while launching the browser pass the profile-directory option. and try to set preferences e.g profile name.
EdgeOptions options = new EdgeOptions();
options.AddArgument(@$"user-data-dir=directory-path");
options.AddArgument(@$"profile-directory=my-directory}");
options.AddUserProfilePreference("profile.name", "My Profile Name");
var driver = new EdgeDriver(options);
you will notice that the profile name is not changed, and when you remove the profile-directory path it will work.
I verify this by opening the browser preference file of the default profile and it is (My Profile Name) what I provided in AddUserProfilePreference method, but the presence file of the mentioned directory is Profile 1.
Relevant log output
Starting Microsoft Edge WebDriver 110.0.1587.41 (dec2c0803210602702555b3ee7cdbf59c9a7eb17) on port 57351
To submit feedback, report a bug, or suggest new features, please visit https://github.com/MicrosoftEdge/EdgeWebDriver
Only local connections are allowed.
Please see https://aka.ms/WebDriverSecurity for suggestions on keeping Microsoft Edge WebDriver safe.
Microsoft Edge WebDriver was started successfully.
DevTools listening on ws://127.0.0.1:57354/devtools/browser/483ce853-7a3e-408f-a5d0-0b3bf69590f2
[1677681165.398][WARNING]: virtual void DevToolsClientImpl::AddListener(DevToolsEventListener *) subscribing a listener to the already connected DevToolsClient. Connection notification will not arrive.
[11360:11088:0301/193252.247:ERROR:device_event_log_impl.cc(218)] [19:32:52.247] USB: usb_device_handle_win.cc:1046 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Operating System
Windows 10
Selenium version
C# 4.0
What are the browser(s) and version(s) where you see this issue?
Microsoft Edge 110.0.1587.57
What are the browser driver(s) and version(s) where you see this issue?
msedgedriver 110.0.1587.57
Are you using Selenium Grid?
No response