accept ssl cert with marionette firefox webdrive python splinter
Asked Answered
W

3

2

when using python splinter firefox 47 marionette new webdriver, it gives certificate error when access the website i want, i tried to accept ssl certs with

browser = Browser('firefox', capabilities = {'marionette': True, 'acceptSslCerts': True})

or using trustAllSSLCertificates instead of acceptSslCerts, but still gives me certificate error, what is the problem?

Wynny answered 16/6, 2016 at 20:2 Comment(0)
S
5

The Firefox bug is now resolved: https://github.com/mozilla/geckodriver/issues/93

For now, you need to install the latest Firefox Nightly build (52 or 53) if you want to use this feature right away: https://nightly.mozilla.org/

Then, the following code will work (Python selenium only here, but my guess is that you can replace "acceptSslCerts" with the latest: "acceptInsecureCerts" in your code)

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

caps = DesiredCapabilities.FIREFOX.copy()
caps['acceptInsecureCerts'] = True
ff_binary = FirefoxBinary("path to the Nightly binary")

driver = webdriver.Firefox(firefox_binary=ff_binary, capabilities=caps)
driver.get("https://expired.badssl.com")

edit: I am not sure how to pass the Nightly binary to Splinter though - https://github.com/cobrateam/splinter/pull/437 - hopefully the standard version of Firefox will be delivered on 2017-03-06 https://wiki.mozilla.org/RapidRelease/Calendar

Stith answered 18/1, 2017 at 4:58 Comment(0)
U
2

I am also facing this issue.

This has been acknowledged as a bug. https://bugzilla.mozilla.org/show_bug.cgi?id=1103196

There may be a workaround I havent tried it yet. Programmatically Install Certificate into Mozilla

Uncharitable answered 22/6, 2016 at 17:38 Comment(1)
unfortunately default profile feature has been removed starting from Firefox 46. forums.mozillazine.org/viewtopic.php?f=38&t=3002375 the only way to make this work is to give splinter specific existing profile path you normally use that you added exception for the certificate, instead of leaving splinter to create temp profile while runningWynny
L
1

edit: it's not necessary to use the nightly firefox anymore

Rémi's answer is correct, thank you. I have been facing the same issue in Java, in case someone else stumbles across this here's the Java solution:

DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability("acceptInsecureCerts", true);

FirefoxDriver driver = new FirefoxDriver(caps);

there isnt a CapabilityType.ACCEPT_INSECURE_CERTS yet as per Selenium version 3.3.1 and the CapabilityType.ACCEPT_SSL_CERTS doesn't work, thus use "acceptInsecureCerts". Also the constructor FirefoxDriver(binary, profile, capabilities) is deprecated but AFAIK this is the only way to use a custom Firefox binary (?).

Limonene answered 3/4, 2017 at 13:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.