Answer a question

When I open a page with selenium webdriver I get a chrome dialog box "Choose certificate". The default certificate is the right one so I only have to click OK button. But I have problem with this. 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 on line drv.get("https://example.com/login"). Webdriver is waiting for page to load. And before that line there is no chrome dialog box.

How can I handle this?

Answers

You'll have to use something like AutoIT:

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

Why you ask? It's an OS dialog, which Selenium does not and probably never will handle, so you'll have to turn to other solutions (in C# you should use native Win32 API methods to click the button for instance).

Logo

Python社区为您提供最前沿的新闻资讯和知识内容

更多推荐