Selenium: FirefoxProfile fp = new FirefoxProfile(); fails with Cannot find a file named \bin\webdriver_prefs.json' or an embedded resource with the id 'webdriver_preferences.json'.

Created on 12 Aug 2020  路  2Comments  路  Source: SeleniumHQ/selenium

馃挜 Regression Report

Cannot find a file named 'D:xxxxxxxxxxxxbinwebdriver_prefs.json' or an embedded resource with the id 'webdriver_preferences.json'.
at OpenQA.Selenium.Internal.ResourceUtilities.GetResourceStream(String fileName, String resourceId)
at OpenQA.Selenium.Firefox.FirefoxProfile.ReadDefaultPreferences()
at OpenQA.Selenium.Firefox.FirefoxProfile..ctor(String profileDirectory, Boolean deleteSourceOnClean)
at OpenQA.Selenium.Firefox.FirefoxProfile..ctor(String profileDirectory)
at OpenQA.Selenium.Firefox.FirefoxProfile..ctor()
A clear and concise description of what the regression is.

-->

Worked up to version: Selenium.WebDriver.4.0.0-alpha01

Stopped working in version: Selenium.WebDriver.4.0.0-alpha02

To Reproduce

public void TestFirefoxVersion()
{
FirefoxProfile fp = new FirefoxProfile();
var options = new FirefoxOptions
{
Profile = fp,
BrowserExecutableLocation = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe",

        };
        IWebDriver driver = new FirefoxDriver("path to gecko", options);

        Thread.Sleep(10000);

    }

Tried with all latest Gecko versions

Environment

OS: Windows 10
Browser: Firefox, FirefoxPortable
Browser version: Firefox 78.0.2
Browser Driver version: GeckoDriver 0.24 -->
Language Bindings C#

needs-triaging

Most helpful comment

@dtopuzov And already fixed in 67cbd51.

All 2 comments

Same exception with 4.0.0-alpha05.

Code to reproduce:

            FirefoxOptions options = new FirefoxOptions
            {
                AcceptInsecureCertificates = true,
                Profile = new FirefoxProfile(@"path-to-some-existing-profile")
            };

            FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
            service.Host = "::1";

            return new FirefoxDriver(service, options, TimeSpan.FromMinutes(3));

It is fine without Profile = new FirefoxProfile(@"path-to-some-existing-profile") line.

Looks to be caused by https://github.com/SeleniumHQ/selenium/commit/9b8758a5bf93a07b76eae637483fd975a228e939

@dtopuzov And already fixed in 67cbd51.

Was this page helpful?
0 / 5 - 0 ratings