accept ssl cert with marionette firefox webdrive python splinter

前端 未结 3 1655
北荒
北荒 2020-12-04 02:58

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

3条回答
  •  醉话见心
    2020-12-04 03:19

    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

提交回复
热议问题