【问题标题】:How to use acceptSslCerts with RemoteWebdriver?如何将 acceptSslCerts 与 RemoteWebdriver 一起使用?
【发布时间】:2016-11-30 00:58:49
【问题描述】:

我试图强制 selenium 忽略 SSL 错误,但无法弄清楚。见过acceptSslCerts的能力,但是在使用firefox的时候好像没有任何效果

【问题讨论】:

    标签: python selenium firefox automation


    【解决方案1】:

    对于您的方案,您可以尝试类似的方法。它在 Firefox 浏览器上对我来说效果很好。

    按照以下步骤创建新的 firefox 配置文件并在那里接受 SSL 证书。

    1. 关闭所有 Firefox 窗口
    2. 在“运行”对话框中,输入:“firefox.exe -p”,然后单击“确定”。
    3. 点击“创建配置文件”
    4. 为您的新配置文件创建一个名称(例如 Selenium)
    5. 点击“选择文件夹”
    6. 选择容易找到的东西——比如“C:\NewFirefoxProfile”
    7. 点击完成
    8. 现在选择新创建的配置文件后,启动 Firefox。打开您收到“安全连接问题”的特定网址,接受此配置文件的 SSL 证书

    现在使用新创建的 firefox 配置文件运行您的 selenium 测试。根据您的要求修改以下代码。

    from selenium import webdriver
    
    profile = webdriver.FirefoxProfile()
    profile.accept_untrusted_certs = True
    profile.assume_untrusted_cert_issuer=True
    
    driver = webdriver.Firefox(firefox_profile='C:/NewFirefoxProfile)
    driver.get('https://cacert.org/')
    

    【讨论】:

      猜你喜欢
      • 2023-03-22
      • 2012-03-21
      • 2016-12-11
      • 2021-01-02
      • 1970-01-01
      • 2023-03-13
      • 2014-09-25
      • 2016-01-30
      • 2015-12-13
      相关资源
      最近更新 更多