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

查看:23
本文介绍了如何使用 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 中启用此功能的评论.还有 这个 StackOverflow 问题关于同样的问题,也适用于 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天全站免登陆