【发布时间】:2021-09-16 18:19:57
【问题描述】:
我想获取在 chrome 浏览器中看到的网页的证书详细信息。详细信息如:
- 颁发给
- 颁发者
- 有效期
我不确定如何继续或在哪里查找证书。我试图在网络请求中查找相同的内容,但我认为证书详细信息未存储在网络请求中。我尝试了以下代码:
from seleniumwire import webdriver
import pytest
from selenium.webdriver.chrome.options import Options
import time
import allure
class Test_main():
@pytest.fixture()
def test_setup(self):
# initiating browser
chrome_options = Options()
chrome_options.binary_location=\
r"C:\Users\libin.thomas\AppData\Local\Google\Chrome\Application\chrome.exe"
chrome_options.add_argument('--start-maximized')
chrome_options.add_argument('--headless')
self.driver = webdriver.Chrome(executable_path=r"D:/Python/Sel_python/drivers/chromedriverv86/chromedriver.exe",options=chrome_options)
# terminate script
yield
self.driver.close()
self.driver.quit()
print("Test completed")
@allure.severity(allure.severity_level.BLOCKER)
def testcase_01(self, test_setup):
self.driver.get("https://lifesciences.cactusglobal.com/")
title = self.driver.title
print("Page title: "+title)
#Capturing network requests
for request in self.driver.requests:
if request.response:
print(
request.url,
request.response.status_code,
request.response.headers
)
我是否可以使用 selenium 或任何 Pypi 包获取 SSL 证书的详细信息?
【问题讨论】:
-
你能检查 SSL 证书窗口吗?
-
@cruisepandey 不,我不能在 Windows 中这样做:(
-
所以排除了硒。
-
@LibinThomas:见pastebin.com/7BPyyMNE
-
@LibinThomas:因为这种方法有助于我做出更详尽的真实答案,这也指出了这种方法的一些问题
标签: python selenium ssl selenium-webdriver