1

Do not mark question as "Duplicate", please, because it's not. I'm asking about creating Chrome profile, not about opening them, please help.

This question asking how to create Chrome profiles programmatically using C# for further using it in selenium (prefer a way using selenium\chromedriver if it's possible).

I need to create one chrome profile for each login in logins[] array (Alex, Lucas, Josh).

//some way to create chrome profiles.
foreach(string login in logins){
options.AddArguments("--user-data-dir=" + pathToProfiles + login); //using created profile
using (IWebDriver webDriver = new ChromeDriver(options))
{
webDriver.Navigate().GoToUrl(@"https://www.facebook.com"); // or any other website.
}
}

The way of creating chrome profiles manually not fit in my case.

I found article with almost same issue, but for Firefox: Creating Firefox profile and switching off the marionette

Ennorath
  • 48
  • 1
  • 7

2 Answers2

0

I can create new profile in Chrome with name "template" and when I need to create new one, just copy paste "template" and rename folder to "Alex".

But I'm searching for normal way to solve it. Maybe ChromeDriver has function to create profile?

Ennorath
  • 48
  • 1
  • 7
0
options.AddArguments("--user-data-dir=" + pathToProfiles + login);

This method can create a new profile but it may fail because of the permissions on the profiles folder. So changing the path to a app path can create the profile successfully

options.AddArguments("--user-data-dir=" + "c:\myapp\"+ login);
Tareq
  • 1,397
  • 27
  • 28