How to set Firefox Profile in C# to accept untrusted certificates?

656 Views Asked by At

I was looking for solution on Stack, but nothing is working in my case. I tried :

    public RemoteWebDriver runDriver()
{

        FirefoxDriverService service = 
        FirefoxDriverService.CreateDefaultService();
        service.HideCommandPromptWindow = true;

        FirefoxBinary fb = new FirefoxBinary();
        FirefoxProfile fprofile = new FirefoxProfile();
        FirefoxOptions fo = new FirefoxOptions();
        fo.Profile = fprofile;

        fprofile.AcceptUntrustedCertificates = true;

and :

    fprofile.SetPreference("network.automatic-ntlm-auth.trusted-uris", very_dangerous_url);

when it gets to the point :

    fb.StartProfile(fprofile);
    return driver;
}

It breaks.

I'm working in C# with Selenium Webdriver and I want my browser to accept one page without certificates.

1

There are 1 best solutions below

0
On

This is a different solution than what you are trying to do but will get to you to the same result. You can create a custom firefox profile and export it. This will allow you to load the profile at runtime when creating the driver. Here are steps on how to create your profile. http://toolsqa.com/selenium-webdriver/custom-firefox-profile/. Hopefully this helps you, I use this strategy for firefox settings in c# and it works like a charm.