首页 > 解决方案 > 如何使用 Selenium 检测 SSL 证书信息?

问题描述

我正在使用 Selenium 收集一些数据,其中一项要求是获取 SSL 证书信息,例如颁发者、到期日期、混合内容等。

Selenium 有没有办法获取这些信息?

我将 Selenium 与 Ruby 一起使用。

require 'selenium-webdriver'
options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'])
driver = Selenium::WebDriver.for(:chrome, options: options)
driver.get 'https://stackoverflow.com/'

之后,我对如何获取 SSL 证书的任何信息一无所知。

标签: rubyseleniumselenium-webdriver

解决方案


看看这个可能会有所帮助。

添加 Chrome 性能日志记录Network.responseReceived事件,我们可以从中获取有关 Network.Response 中的安全详细信息的信息。

参考:https ://chromedevtools.github.io/devtools-protocol/tot/Network/#type-Response


推荐阅读