Python + Selenium = connect in a website using pfx certificate

Job ID: 32978139

Budget: $30 – $250 USD

Hello.

I need to connect in a website that requires a digital certificate (pfx certificate), with selenium.

When I try to connect, the system show a pop up asking to choose the digital certificate that will be used.

This pop up comes from the OS, so selenium don't control it.

I'm trying to get a solution for this problem, but without success ultill now.

I need a solution that permit me to work with diferent certificates, so the option to configure browser to automatically choose a certificate is not viable.

It also needs to work with a headless browser, becasuse the application wil work in a cloud server.

I'm looking for a consultant who can give me a solution.


For my research, i found that maybe the solution is to configure a proxy and to connect it to the webdriver, but I coudn't make it work:

Example:

from selenium import webdriver
import socket
import ssl



proxy = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
proxy_ssl = ssl.wrap_socket(proxy, 'key.pem', 'cert.pem',)



chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % proxy)
chrome = webdriver.Chrome(chrome_options=chrome_options)

chrome.get("https://www1c.siscomex.receita.fazenda.gov.br/siscomexImpweb-7/private_siscomeximpweb_inicio.do")
Related categories: Python Selenium