FirefoxOptions (desired capability) to DISallow certificate errors

It’s normally the case that for testing purposes you want security certificate warnings and errors to be turned off. Me too. However…

I have a need to rattle off a test against a bunch of servers (to which our clients connect) that need their certificates updated on a yearly basis. So, for me, a “good” result would be finding a page that throws up this:

Unfortunately, the inline profile generated by Katalon to conduct testing in Firefox(geckodriver) is setting a preference to disable certificate warnings/errors. I assume this taken from the console means that…

What I’ve tried:

{
  "FIREFOX_DRIVER":{
    "moz:firefoxOptions":{
      "prefs": 
        "webdriver_accept_untrusted_certs":false,
        "webdriver_assume_untrusted_issuer":false
      }
    }
  }
}

So, does anyone know how to “undo” whatever Katalon is doing in geckodriver/Firefox?

TIA!

2 Likes

Hi,

If you are paid user, please submit ticket here Katalon Help Center for better support

1 Like

Also tried this:

{ 
  "FIREFOX_DRIVER": {
    "acceptInsecureCerts":false
  }
}

That doesn’t work either.

1 Like

could you try this in your test script @Russ_Thomas

import org.openqa.selenium.firefox.FirefoxOptions;

FirefoxOptions options = new FirefoxOptions();

options.setPreference(“marionette.profile”, “path/to/profile”);

options.setPreference(“security.tls.version.enable-deprecated”, true);

WebDriver driver = new FirefoxDriver(options);

1 Like

Thanks @Monty_Bagati

How? Where? Does Marionette use the Firefox profile path? In which case, isn’t a new Firefox profile created each time a TC is executed?

From 3 consecutive TC runs…

"C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-no-remote" 
"-profile" "C:\\Users\\russ\\AppData\\Local\\Temp\\rust_mozprofileBnu0DC"

"C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-no-remote" 
"-profile" "C:\\Users\\russ\\AppData\\Local\\Temp\\rust_mozprofileiWucXy"

"C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-no-remote" 
"-profile" "C:\\Users\\russ\\AppData\\Local\\Temp\\rust_mozprofilehiSnjB"

1 Like

Marionette uses the Firefox profile path to start a Firefox instance with the Marionette server enabled. The Marionette server is a remote control interface for Firefox that is used by test automation frameworks such as Selenium and Katalon Studio.

The Firefox profile path is specified using the marionette.profile preference. This preference can be set in the Firefox profile or in the FirefoxOptions object that is passed to the Firefox driver constructor.

When Marionette starts a Firefox instance, it uses the Firefox profile path to locate the Firefox profile. Marionette then copies the Firefox profile to a temporary location and starts Firefox from that location. This prevents Marionette from interfering with your regular Firefox profile.

When the Marionette test is finished, Marionette deletes the temporary Firefox profile. This means that a new Firefox profile is created each time a test is executed.

However, you can configure Marionette to reuse the same Firefox profile for multiple tests. To do this, you need to set the marionette.reuse.profile preference to true. This will tell Marionette to keep the temporary Firefox profile after the test is finished and reuse it for the next test.

Reusing the same Firefox profile for multiple tests can speed up your tests, but it is important to be aware of the risks associated with doing this. For example, if a test fails and overwrites the Firefox profile, then subsequent tests may fail.

To answer your question directly, Marionette does use the Firefox profile path. However, Marionette does not create a new Firefox profile each time a test is executed, unless the marionette.reuse.profile preference is set to false.

btw , is your initial query resolved @Russ_Thomas ?

I won’t know for a few hours yet.

let us know if it has worked . cheers

Here’s the solution:

    FirefoxOptions options = new FirefoxOptions()
    options.setAcceptInsecureCerts(false)
    WebDriver driver = new FirefoxDriver(options)
    DriverFactory.changeWebDriver(driver)
1 Like

Lovely @Russ_Thomas

Just as a heads up, this will also wipe any other caps that Katalon auto-sets. If you needed to preserve those for any reason, then instead of creating your own FirefoxOptions instance you’d want to retrieve the existing driver and get the options from that, add your setAcceptInsecureCerts(false), then create the new driver. You may have already been aware of this but just for everyone else’s knowledge.

Nice work!