0

I am currently updating my C# solution with the new Marionette driver for Firefox.

I have managed to get the driver to successfully launch a url with the following code

        FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(Directory.GetCurrentDirectory(),"wires-0.6.0-win.exe");
        service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";

        FirefoxDriver driver = new FirefoxDriver(service);

        driver.Navigate().GoToUrl("http://www.google.com");

However i need to add a profile to the driver at initialisation in order to set the proxy. I was previously doing this like the following (for older Firefox versions).

    private static IWebDriver InitialiseFirefoxDriver(Proxy proxy)
    {
        FirefoxProfile profile = new FirefoxProfile();

        if (proxy != null)
        {
            profile.SetProxyPreferences(proxy);
        }

        return new FirefoxDriver(profile);
    }

Unfortunately the FirefoxDriver constructor only allows me to pass in either a FirefoxDriverService or a FirefoxProfile. Does anybody know of a way that i can manage to give the driver both sets of config information before creating the driver (or even after)?

Thanks.

1 Answers1

0

This is example code use FirefoxProfile & FirefoxDriverService. I want hide CommandPromptWindow and Mute.

FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.HideCommandPromptWindow = true;
FirefoxProfile _Profile = new FirefoxProfile();
_Profile.SetPreference("media.volume_scale", "0.0");
FirefoxOptions option = new FirefoxOptions();
option.Profile = _Profile;

var driver = new FirefoxDriver(service,option,TimeSpan.FromSeconds(20));
driver.Navigate().GoToUrl("https://www.youtube.com/watch?v=hxiitzCKRek");