python - 如何让 Selenium 打开带有真实证书的 HTTPS URL?

标签 python selenium https

我正在尝试使用 selenium 来自动执行一些基于浏览器的数据输入。目标 URL 是 HTTPS,但它是一个实际的公共(public)网站,而不是自签名证书。我正在运行以下代码:

from selenium import selenium
import unittest, time, re

class python_2_remote_control(unittest.TestCase):
    def setUp(self):
        self.verificationErrors = []
        self.selenium = selenium("localhost", 4444, "*chrome", "https://actualurl")
        self.selenium.start()

    def test_python_2_remote_control(self):
        sel = self.selenium
        sel.type("id=loginid", "etc.")
        more...

代理已加载,但实际 URL 似乎从未加载到其中,我的第一个登录命令都失败了。有什么可能失败的感觉吗?

最佳答案

如果您的 https 需要证书,您将需要一个接受该证书的自己的 selenium firefox 配置文件。

谷歌如何在 selenium 中使用自定义 firefox 配置文件。

服务器命令行:

java -jar selenium-server.jar -log SeleniumServer.log -firefoxProfileTemplate "C:\ffprofile" -trustAllSSLCertificates

关于python - 如何让 Selenium 打开带有真实证书的 HTTPS URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8958785/

相关文章:

iis - 当 SSL 证书不再有效时从 https 重定向到 http

asp.net-mvc - BotDetect CAPTCHA 在 https 中不起作用

python - 将终端输出重定向到 tkinter

python - 不明白为什么我的图像在 pygame 中不会移动

python - 无法为 Google Cloud Storage 的网址签名

java - 使用 Selenium webdriver 从文件系统拖放文件

delphi - 如何在 Delphi 中下载一个非常简单的 HTTPS 页面?

python - 将字节字符串转换为 matplotlib 可读时间

python - 如何从socket.timeout错误中恢复是selenium(python)

java - Cucumber 特征文件不识别步骤