使用selenium webdriver chrome处理'选择数字证书' [英] Handling 'choose a digital certificate' with selenium webdriver chrome

查看:3001
本文介绍了使用selenium webdriver chrome处理'选择数字证书'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用selenium webdriver打开一个页面时,我得到一个对话框选择证书。默认证书是正确的,所以我只需点击确定按钮。但我有这个问题。我有python代码:

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

之后,我想要做一些事情:

  drv.switch_to_alert()。accept()

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

问题是代码在drv线路上停止执行.get( https://example.com/login )。 Webdriver正在等待页面加载。

如何处理这个问题?

解决方案

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



你为什么要问?这是一个操作系统对话框,Selenium不会也可能永远不会处理,因此您必须转向其他解决方案(在C#中,您应该使用本机Win32 API方法来点击按钮)。


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?

解决方案

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).

这篇关于使用selenium webdriver chrome处理'选择数字证书'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆