Maxime Joyal
Maxime Joyal

Reputation: 183

how to use a FirefoxProfile with a IWebDriver

I have lots of problem with Firefox. For most of them, I found lots of solution that use FirefoxDriver object. However I need to use RemoteWebDriver.

All the solutions to my problem use a FirefoxProfile object. is there a way to use this profile for the IWebDriver?

One of the thing I need to do is use the profile to do this:

Firefox webdriver opens first run page all the time

here is how I use my IWebDriver:

driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox(), TimeSpan.FromSeconds(timeout));

Upvotes: 0

Views: 100

Answers (1)

Florent B.
Florent B.

Reputation: 42518

First create the FirefoxProfile and then add it to the capabilities:

// create the profile
var profile = new FirefoxProfile();

// create the capabilities
var capabilities = DesiredCapabilities.Firefox();
capabilities.SetCapability(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());

// start the remote driver
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities);

Upvotes: 1

Related Questions