如何使用 Selenium 禁用 Firefox 的不受信任的连接警告? [英] How to disable Firefox's untrusted connection warning using Selenium?

查看:26
本文介绍了如何使用 Selenium 禁用 Firefox 的不受信任的连接警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图找到一种方法来禁止 Firefox 在每次连接使用不受信任的"连接时发出警告.证书,与硒.我相信最有效的解决方案是设置一个浏览器首选项.

Trying to find a way to disable Firefox from raising a warning every time a connection uses an "untrusted" certificate, with Selenium. I believe that the kind of solution that would work the best would be to set one of the browser preferences.

推荐答案

我找到了 关于在 Selenium for Java 中启用此功能的评论.还有 this StackOverflow question about the same issue, also for Java 对于 Python,这是我的想要的目标语言,我想出了这个,通过浏览 FirefoxProfile 代码:

I found this comment on enabling this functionality in Selenium for Java. There is also this StackOverflow question about the same issue, also for Java For Python, which was my desired target language, I came up with this, through browsing the FirefoxProfile code:

profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True

据我测试,这产生了预期的行为.

Which, as far as I have tested, has produced the expected behavior.

希望这对某人有所帮助!

Hope this helps somebody!

这篇关于如何使用 Selenium 禁用 Firefox 的不受信任的连接警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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