[英]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.