接受ssl证书与木偶firefox webdrive python碎片 [英] accept ssl cert with marionette firefox webdrive python splinter

查看:265
本文介绍了接受ssl证书与木偶firefox webdrive python碎片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用python splinter firefox 47木偶新的webdriver时,它会在访问我想要的网站时出现证书错误,我试图接受ssl证书

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

或者使用trustAllSSLCertificates而不是acceptSslCerts,但是仍然给我证书错误,是问题所在? 现在解决了Firefox的错误:
https://github.com/mozilla/geckodriver/issues/93



现在,如果你想马上使用这个功能,你需要安装最新的Firefox Nightly build(52或53):
https://nightly.mozilla.org/

然后,下面的代码将工作(Python硒只在这里,但我的猜测是你可以替换acceptSslCerts与最新的:acceptInsecureCerts在您的代码)

 从selenium进口webdriver $ b $从selenium.webdriver.common。 desired_capabilities从selenium.webdriver.firefox.firefox_binary导入DesiredCapabilities 
导入FirefoxBinary

caps = DesiredCapabilities.FIREFOX.copy()
caps ['acceptInsecureCerts'] = True
ff_binary = FirefoxBinary(Nightly二进制文件路径)

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

编辑:我不知道如何将Nightly二进制传递给Splinter - 一个href =https://github.com/cobrateam/splinter/pull/437 =noreferrer> https://github.com/cobrateam/splinter/pull/437 - 希望标准版的Firefox将于2017-03-06
交付 https://wiki.mozilla.org/ RapidRelease / Calendar


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?

解决方案

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

这篇关于接受ssl证书与木偶firefox webdrive python碎片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆