【发布时间】:2018-05-09 22:33:06
【问题描述】:
我正在使用在所有浏览器中都有证书弹出窗口的网站,我使用警报代码示例处理弹出窗口:
try
{
IAlert alert = driver.SwitchTo().Alert();
if (alert != null)
{
alert.Accept();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.Print(ex.Message);
}
但是当我使用 chrome 驱动程序时,它没有捕捉到警报并抛出异常:
对 URL 的远程 WebDriver 服务器的 HTTP 请求 http://localhost:65505/session/3c3a49f5ea328ffff6cc44effaa8326f/alert_text 60 秒后超时。
弹出图片:
它不是 web html 代码的一部分,所以我在这里缺少什么?
谢谢。
【问题讨论】:
-
你确定这是一个警报,而不是一个框架?
标签: c# .net selenium selenium-chromedriver