'Is there a way to get detail ssl certificate info in selenium?
I need to get an expiration date of a ssl certificate on a site using selenium. Is there some way to do that? I know that there is selenium errors that is triggered if ssl certificate is expired, but how can I get info about date of expiration if it's still valid?
Solution 1:[1]
It is probably impossible to get these information using selenium since it is impossible to get these information from inside the browser using JavaScript. One can try to access the website though directly using some Python code:
import ssl
conn = ssl.create_connection(('google.com',443))
ctx = ssl.create_default_context()
conn = ctx.wrap_socket(conn, server_hostname = 'google.com')
print(conn.getpeercert())
For more details see here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Prophet |
