'Web automation: login with certificate Chrome Python

I am trying to automate a task which has to be done about 50 to 100 times a day. What I want to achieve is to open the corresponding website, login using a certificate, fill in two fields and click on submit.

I can figure out how to open the website and fill in the correct fields with the data using find element by xpath. However, I cannot manage to automate the login with the certificate. The login via the certificate is a pop-up within Google Chrome where I have to click OK or press the enter button (the machine I'm working on has only 1 certificate so it's automatically selected). The issue is that the login pop-up does not seem to be part of Chrome, I cannot find the xpath of the "OK" button.

At the moment I have the following code:

from selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get('https://example.com')

Does anyone know in what direction I should move foreward?

Thanks!



Solution 1:[1]

Can you just do a time.sleep(10) and then send a keyDown? i.e. wait until you can assume that the popup has appeared, then send an Enter key to the screen?

You can make this more concrete by sending enter every 5 seconds until your screen finds some xPath that appears

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 Aron Atilla Hegedus