0

Using Selenium WebDriver 3.0.1.0 with Marionette and geckodriver 0.11.1 and Firefox 50 from C#. I have used FirefoxOptions motivated by this ObsoleteAttribute:

FirefoxDriver should not be constructed with a FirefoxBinary object. Use FirefoxOptions instead.

The code is:

FirefoxOptions fo = new FirefoxOptions();
firefoxProfile = new FirefoxProfile();
firefoxProfile.SetPreference("browser.download.folderList", 2);
firefoxProfile.SetPreference("browser.download.dir", DOWNLOAD_FOLDER);
firefoxProfile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv");
firefoxProfile.SetPreference("browser.startup.homepage_override.mstone", "ignore");
firefoxProfile.SetPreference("trustAllSSLCertificates", true);
firefoxProfile.AcceptUntrustedCertificates = true;

fo.Profile = firefoxProfile;
driver = new FirefoxDriver(fo);

It looks to me, like the firefoxProfile specified is not being used at all, SSL certificate errors appear and dowload dialog is being displayed regardless on profile settings. I thought that it does not ignore SSL certificate errors because of this bug, but it looks like all the profile settings are being ignored.

How to make that the profile settings take effect? (so that no download dialog appears and SSL errors are ignored)

That code worked before switching to Marionette, looks like Marionette is not yet ready to use?

Community
  • 1
  • 1
Vojtěch Dohnal
  • 7,867
  • 3
  • 43
  • 105

2 Answers2

0

I'm not sure that profile settings were actually ignored:

  1. You should check MIME type of file you intend to download. Does it really text/csv?
  2. There is no such preference as trustAllSSLCertificates. I think you need firefoxProfile.SetPreference("security.ssl.enable_ocsp_stapling", false);
Andersson
  • 51,635
  • 17
  • 77
  • 129
0

This is working smoothly to avoid visiting SSL certificate errors page:

    public static FirefoxOptions FfOptions()

            {
                FirefoxOptions option = new FirefoxOptions();
                option.AcceptInsecureCertificates = true;
                return option;
            }

    public static IWebDriver driver = new FirefoxDriver(FfOptions());