Sunday, July 9, 2017

How to use existing Firefox profile in Selenium C#?

Leave a Comment

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(); 

2 Answers

Answers 1

You have to pass the profile object while instantiating the firefox driver. Like,

driver = new FirefoxDriver(profile); 

See here for details.

Answers 2

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

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment