Selenium无法处理IE中的“确认证书”弹出窗口 [英] Selenium can't deal with Confirm Certificate popup in IE
问题描述
我正在尝试登录网站并使用Selenium通过代码截取屏幕截图。到目前为止,除了一个问题之外,它一直很好用:每次我手动和使用Selenium访问网站时,弹出窗口都会要求我确认安全证书。
I'm trying to log into a website and use Selenium to take a screenshot through code. So far, it's been working great except for one problem: every time I access the website, both manually and with Selenium, a popup asks me to confirm a security certificate.
证书很好,但我不能为我的生活让Selenium接受窗口。我知道它可以处理警报并接受它们:
The certificate is good, but I cannot for the life of me get Selenium to accept the window. I know it can deal with Alerts and accept them thusly:
driver.Navigate().GoToUrl("https://www.securewebsite.com");
driver.SwitchTo().Alert().Accept();
但是盒子不会消失或作出反应,并试图对驱动程序做任何事情,除了接受或拒绝警报(没有效果)会导致模态对话存在错误。
but the box doesn't disappear or react, and attempting to do anything with the driver besides accepting or declining the alert (with no effect) results in a Modal Dialog Present error.
我正在寻找一种方法来关闭此弹出窗口或某种方式来关闭Selenium在代码中处理它,最好是后者。如果我能提供更多信息,请告诉我。
I'm looking for either a way to turn off this popup or a way for Selenium to deal with it in code, preferably the latter. Let me know if I can provide any more information.
推荐答案
好吧,我无法理解,所以我只是禁用了弹出窗口。这是一个糟糕的做法,并将应用程序绑定到IE的特定实例,但这是我能想到的全部。
Alright, I couldn't figure it out, so I just disabled the popup. It's poor practice and binding the application to the specific instance of IE, but it was all I could come up with.
这篇关于Selenium无法处理IE中的“确认证书”弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!