thiago.heron
thiago.heron

Reputation: 15

Selenium - Firefox Profile doesn't recognize certificates

I need select automatically my own certificates using selenium. Aftes some studies, I found the best way is create a Firefox Profile, add Certificates and in the Selenium Webdriver "import" my Profile.

What I trying to do?

Whats does happen?

# Open My Profile
profile = webdriver.FirefoxProfile('/home/USERNAME/.mozilla/firefox/ri4nkdyn.default')

# Preferences that I tested
profile.set_preference("security.default_personal_cert", "Select Automatically")
profile.set_preference("security.osclientcerts.autoload", True)
profile.set_preference("security.disable_button.openCertManager", True)
profile.set_preference("security.enterprise_roots.enabled", True)
profile.set_preference("accept_untrusted_certs", True)
profile.set_preference("assume_untrusted_cert_issuer", True)

# Firefox Binary
ff_binary = FirefoxBinary('/usr/bin/firefox')

# Desired Capabilities that I tested
desired_capabilities = DesiredCapabilities.FIREFOX.copy()
desired_capabilities["acceptInsecureCerts"] = True
desired_capabilities['acceptSslCerts'] = True


# Create the Webdriver Firefox
driver = webdriver.Firefox(
    firefox_binary=ff_binary,
    firefox_profile=profile,
    desired_capabilities=desired_capabilities
)

How I can solve this? What's wrong?

Upvotes: 1

Views: 2189

Answers (1)

Miloš Stanković
Miloš Stanković

Reputation: 443

Edit your firefox profile by choosing cert. or type "about:config" in the browser address bar. Verify Preference Name "security.default_personal_cert" is set to "Select Automatically" and after that use that profile for your firefox tests.

Upvotes: 0

Related Questions