接受带有 marionette firefox webdrive python splinter 的 ssl 证书
问题描述
当使用 python splinter firefox 47 marionette new webdriver 时,访问我想要的网站时出现证书错误,我尝试使用
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})
browser = Browser('firefox', capabilities = {'marionette': True, 'acceptSslCerts': True})
或者使用trustAllSSLCertificates而不是acceptSslCerts,但仍然给我证书错误,是什么问题?
or using trustAllSSLCertificates instead of acceptSslCerts, but still gives me certificate error, what is the problem?
解决方案
Firefox bug 现已解决:https://github.com/mozilla/geckodriver/issues/93
The Firefox bug is now resolved: https://github.com/mozilla/geckodriver/issues/93
现在,如果您想立即使用此功能,您需要安装最新的 Firefox Nightly 版本(52 或 53):https://nightly.mozilla.org/
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/
然后,下面的代码就可以工作了(Python selenium 只在这里,但我猜你可以在你的代码中用最新的:acceptInsecureCerts"替换acceptSslCerts")
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")
我不确定如何将 Nightly 二进制文件传递给 Splinter - https://github.com/cobrateam/splinter/pull/437 - 希望标准版 Firefox 将于 2017-03-06 交付https://wiki.mozilla.org/RapidRelease/Calendar
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
相关文章