Reputation: 95
I am running automation on the edge browser. Edge browser supports profile and whenever i launch the edge from webdriver, it create new profile. Is there any way I can set the option to launch edge with given user profile ?
Upvotes: 3
Views: 22280
Reputation: 12999
I use Java language as an example. You could use user-data-dir
and profile-directory
to use specific profile to launch Edge with Selenium. The sample code is like below:
System.setProperty("webdriver.edge.driver", "your\\path\\to\\edge\\webdriver\\msedgedriver.exe");
EdgeOptions edgeOptions = new EdgeOptions();
// Here you set the path of the profile ending with User Data not the profile folder
edgeOptions.addArguments("user-data-dir=C:\\Users\\username\\AppData\\Local\\Microsoft\\Edge\\User Data");
// Here you specify the actual profile folder
edgeOptions.addArguments("profile-directory=Profile 2");
edgeOptions.addArguments("--start-maximized");
WebDriver driver = new EdgeDriver(edgeOptions);
driver.get("https://www.google.com");
Note: Change the paths in the code to your owns.
If you don't know the path of the specific profile, you could check edge://version/
like below:
Upvotes: 11