Use browser client certificate with Selenium and PhantomJS

Use PFX client certificates files in Phantomjs and Selenium web automation tools. I want to get up and running a web bot that have to connect to a website via a client certificate.

And i want to use the good Selenium with Python (see Selenium pip) to automate the connection and the interaction to the page but i cannot find any driver that works easily with a client certificate.

The only i can find is PhantomJS (i know it’s discontinued for now, but it just works).

So after long trials and errors i came up with this.

I have a PFX certificate file, password protected. So i have to split the certificate in two different keys, the key file and the client one; with openssl, removing the password protection also (see the Openssl man for more info).

And now we can use Selenium with client certificate!