Python 3.x Selenium-Firefox配置文件不';我不承认证书

Python 3.x Selenium-Firefox配置文件不';我不承认证书,python-3.x,selenium,selenium-webdriver,selenium-firefoxdriver,firefox-profile,Python 3.x,Selenium,Selenium Webdriver,Selenium Firefoxdriver,Firefox Profile,我需要使用selenium自动选择我自己的证书。经过一些研究,我发现最好的方法是创建Firefox配置文件,添加证书并在SeleniumWebDriver中“导入”我的配置文件 真正的问题是: 我想做什么? 在Firefox上创建配置文件用户 添加我的证书 Selenium导入此配置文件 发生了什么事? 如果我打开请求证书的URL,它将正常工作 如果您尝试使用Selenium Python访问URL,Firefox将无法识别我的证书 我怎样才能解决这个问题?怎么了?通过选择证书或在浏

我需要使用selenium自动选择我自己的证书。经过一些研究,我发现最好的方法是创建Firefox配置文件,添加证书并在SeleniumWebDriver中“导入”我的配置文件

  • 真正的问题是:
我想做什么?

  • 在Firefox上创建配置文件用户
  • 添加我的证书
  • Selenium导入此配置文件
发生了什么事?

  • 如果我打开请求证书的URL,它将正常工作
  • 如果您尝试使用Selenium Python访问URL,Firefox将无法识别我的证书

我怎样才能解决这个问题?怎么了?

通过选择证书或在浏览器地址栏中键入“about:config”来编辑您的firefox配置文件。验证首选项名称“security.default\u personal\u cert”是否设置为“自动选择”,然后在firefox测试中使用该配置文件。

通过选择证书编辑firefox配置文件。或者在浏览器地址栏中键入“about:config”。验证首选项名称“security.default\u personal\u cert”是否设置为“自动选择”,然后在firefox测试中使用该配置文件

# 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
)