Reputation: 871
I need to use an existing Firefox profile in Selenium using C#. That profile has a configured add-on that i need.
I found some code googling but those were for Java, I tried the following code but it still doesn't work.
FirefoxProfile profile = new FirefoxProfile("C:\\Users\\username\\Desktop\\software\\Files");
driver = new FirefoxDriver();
Upvotes: 11
Views: 14467
Reputation: 355
In new versions works this method
1) Go to firefox profile selection option
2) Create profile
FirefoxProfile profile = new FirefoxProfileManager().GetProfile("axixa");
FirefoxOptions options = new FirefoxOptions();
options.Profile = profile;
IWebDriver firefox = new FirefoxDriver(options);
Upvotes: 7
Reputation: 871
I found the answer on the official docs of selenium
var profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile("Selenium");
IWebDriver driver = new FirefoxDriver(profile);
Source: Selenium docs
Upvotes: 9
Reputation: 348
You have to pass the profile object while instantiating the firefox driver. Like,
driver = new FirefoxDriver(profile);
See here for details.
Upvotes: 5