Processing "select a digital certificate" using selenium webdriver chrome

When I open the page with selenium webdriver, I get the "Select Certificate" chrome dialog box. The default certificate is correct, so I only need to click OK. But I have a problem with that. I have python code:

drv = webdriver.Chrome() drv.get("https://example.com/login") 

and after that I want to do something like:

 drv.switch_to_alert().accept() 

or

 drv.switch_to_alert().send_keys(Keys.TAB) drv.switch_to_alert().send_keys(Keys.SPACE) 

The problem is that the code stops executing in the drv.get line (" https://example.com/login "). Webdriver is waiting for the page to load. And before this line there is no chrome dialog box.

How can I handle this?

+7
source share
3 answers

You will need to use something like AutoIT:

http://www.autoitscript.com/site/autoit/

Why you're asking? This is an OS dialog box that Selenium does not do and probably will never process, so you will have to turn to other solutions (in C # you have to use your own Win32 API methods to click on a button, for example).

+3
source

Certificates are managed by the OS, not the browser. Delete everything except the required certificate from the browser certificate store, and then configure the browser to automatically select the certificate if only one certificate is present. You can also create a browser profile, and your program will launch this profile or not check HTTPS.

+1
source

Before handling anything here, add below so that it does not freeze as soon as you transfer / issue a certificate. remerber to add the correct waittime back later.

  getDriver().manage().timeouts().pageLoadTimeout(1000, TimeUnit.MILLISECONDS); 

after that, you can try using the keyboard or autoIt.

+1
source

All Articles