M
M
martensit2019-02-07 06:45:48
C++ / C#
martensit, 2019-02-07 06:45:48

How to set the correct directory for FirefoxProfile?

FirefoxDriverService ds = FirefoxDriverService.CreateDefaultService();
ds.HideCommandPromptWindow = true;
FirefoxOptions opt = new FirefoxOptions();
opt.Profile = new FirefoxProfile(@"C:\111\");
IWebDriver Wd = new FirefoxDriver(ds, opt);

Tried like this, but after launching the instance "C:\111\" continues to be empty. I want cookies, cache, extensions to be saved in this folder ...
FirefoxOptions.Profile.ProfileDirectory - this one is read-only, it turns out how to install it is not clear.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
martensit, 2019-02-07
@martensit

You must first create this profile, and then use it. Run firefox with -P prefix (this must be done when all browser instances are closed)
firefox.exe -P
and create a profile in the desired folder.
And then use this profile in selenium in the way that is described in the question.
//thanks @andrew from stackoverflow

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question