简体   繁体   English

如何在 Selenium (Python) 中获取网页的 SSL 详细信息

[英]How to get SSL details of a webpage in Selenium (Python)

I can retrieve the requests in Python, but can't see any functions to retrieve any information regarding SSL in Selenium.我可以检索 Python 中的请求,但看不到任何函数来检索 Selenium 中有关 SSL 的任何信息。 Is there any way to get these information?有没有办法获取这些信息?

As far as I know there is one thing you could do, start selenium with chrome and full performance stats:据我所知,您可以做一件事,使用 chrome 和完整的性能统计信息启动 selenium:

capabilities = DesiredCapabilities.CHROME
capabilities["goog:loggingPrefs"] = {"performance": "ALL"}
driver = webdriver.Chrome(chromedriver_path, desired_capabilities=capabilities)

And then after you loaded the page you desired:然后在您加载所需的页面后:

logs = driver.get_log('performance')
responses = [json.loads(x['message']) for x in logs if 'TLS' in x['message'] and 'Network.responseReceived' in x['message']]

The 'security details' may be found in a structure like this: “安全细节”可以在这样的结构中找到:

responses[0]['message']['params']['response']['securityDetails']

which will tell things about 'certificateId, certificateTransparencyCompliance, cipher, issuer, keyExchange, keyExchangeGroup, protocol, sanList, signedCertificateTimestampList, subjectName, validFrom, validTo' .这将告诉有关'certificateId, certificateTransparencyCompliance, cipher, issuer, keyExchange, keyExchangeGroup, protocol, sanList, signedCertificateTimestampList, subjectName, validFrom, validTo'

I am not sure if is this what you are looking for, your question was a bit vague.我不确定这是否是您要寻找的东西,您的问题有点含糊。

This answer is based on Selenium Python - Get Network response body .此答案基于Selenium Python - Get Network response body

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 python 和 selenium 从网页获取产品详细信息 - Get product details from a webpage using python and selenium 如何使用python获取ssl证书详细信息 - how to get ssl certificate details using python 如何在 selenium python 中递归获取 class 详细信息 - how to get class details recursively in selenium python 如何使用 selenium python 获取网站 SSL 证书到期、颁发者等的详细信息? - How to fetch details of website SSL certificate expiry, issuer etc using selenium python? 如何使用python硒获取网页上所有形式的按钮? - How to get buttons of all forms on webpage using python selenium? 如何使用 Selenium 和 python 从网页获取可见文本? - How to get visible text from a webpage using Selenium & python? 如何使用 selenium python 从网页中单独获取过滤后的项目? - How to get the filtered items alone from webpage using selenium python? 如何使用Selenium和python从网页获取特殊单词的链接? - How to get link with special word from webpage using selenium and python? 如何使用 Selenium 和 Python 获取网页中的结果数量? - How do I get the number of results in a webpage with Selenium and Python? 如何使用某些证书,Selenium,Python来保护网页安全 - How to get to secure webpage with using certain certificate, Selenium, Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM