如何与RemoteWebdriver一起使用acceptSslCerts? [英] How to use acceptSslCerts with RemoteWebdriver?

查看:530
本文介绍了如何与RemoteWebdriver一起使用acceptSslCerts?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图强制硒忽略SSL错误,但一直无法弄清楚。我已经看到了 acceptSslCerts 的能力,但是在使用firefox的时候,它似乎没有任何作用。 / div>

对于你的场景,你可以尝试类似的东西。它在Firefox浏览器上运行良好。

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


  1. 关闭所有的firefox窗口

  2. 在运行对话框中输入:'firefox。然后单击确定。

  3. 点击创建个人资料

  4. 为您的新个人资料创建一个名称(比如Selenium)
  5. >
  6. 点击选择文件夹

  7. 选择一些容易找到的东西 - 比如C:\NewFirefoxProfile完成

  8. 现在选择新创建的配置文件后,启动Firefox。打开获取安全连接问题的特定网址,接受此配置文件的SSL证书 /i.stack.imgur.com/kmUbF.pngrel =nofollow noreferrer>



    现在使用新创建的Firefox配置文件来运行您的硒测试。修改下面的代码根据您的要求。

      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/')


    I am trying to force selenium to ignore SSL errors, but haven't been able to figure it out. I have seen acceptSslCerts capability, but it does not seem to have any effect when using firefox

    解决方案

    For your scenario, you can try something similar to this. It worked well for me on Firefox browser.

    Create new firefox profile by following below step and accept SSL certificates there.

    1. Close all your firefox windows
    2. In the Run dialog box, type in: ‘firefox.exe -p' and then Click OK.
    3. Click "Create Profile"
    4. Create a name for your new profile(say Selenium)
    5. Click "Choose Folder"
    6. Pick something easy to find — like "C:\NewFirefoxProfile"
    7. Click Finish
    8. Now after selecting newly created profile, start Firefox. Open the specific url you were getting 'Secure Connection Issue', accept SSL certificates for this profile

    Now use the newly created firefox profile to run your selenium test. Modify below code as per your requirement.

    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/')
    

    这篇关于如何与RemoteWebdriver一起使用acceptSslCerts?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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