Selenium webdriver Firefox and ssl-prompt

755 views Asked by At

Using version 2.53.1 of Selenium and Firefox browser version 35 together with this script:

package no.mine;

import java.net.MalformedURLException;
import org.junit.Assert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.remote.*;

import java.util.concurrent.TimeUnit;

public class SeleniumAdmin {

private static WebDriver driver = null;

public static void main(String[] args) {

    ProfilesIni profile = new ProfilesIni();
    FirefoxProfile ffProfile = profile.getProfile("MagnusQA");

    ffProfile.setAcceptUntrustedCertificates(true);
    ffProfile.setAssumeUntrustedCertificateIssuer(false);
    ffProfile.setPreference("extensions.shownSelectionUI", true);


    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    capabilities.setCapability(FirefoxDriver.PROFILE, ffProfile);

    driver = new FirefoxDriver(ffProfile);

    driver.get("https://my_url/");
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.close();

    System.exit(0);
}}

I see that the browser is fired up and the dialog appears as shown in the attachment.

enter image description here

I thought that my code:

ffProfile.setAcceptUntrustedCertificates(true);

would assure that the dialog would be handeled (as in "pressing ok")?

How could I tell the browser to "allways accept" the certificate in the Firefox profile?

0

There are 0 answers