【发布时间】:2012-02-03 17:58:13
【问题描述】:
我做错了,将我的 pom.xml 更新为 selenium 2.18.0 现在,操作期间的 UnhandledAlertException 是新功能:
Firefox 和 IE 中的警报处理:如果在操作期间出现警报,则抛出 UnhandledAlertException。未处理的警报也会被解除以减少重复异常。
但是如果我打电话给
driver = new InternetExplorerDriver();
它会导致 Modal dialog present Exception,因为我当前的系统需要代理凭据,这些凭据由循环的 auto-it 脚本填充(以防万一有人需要它):
Dim $arrTitle[2] = ["Authentification required", "Windows Security"]
While 1
For $sTitle In $arrTitle
If WinExists($sTitle) Then
WinActivate($sTitle);
Send("{HOME}");
Send("+{END}");
Send("{DEL}");
Send("user");
Send("{TAB}");
Send("{HOME}");
Send("+{END}");
Send("{DEL}");
Send("password");
Send("{ENTER}");
Sleep(1000)
EndIf
Next
Sleep(500)
WEnd
那么我怎样才能防止这个异常呢?如果我只是
try { driver = new InternetExplorerDriver(); }
catch(UnhandledAlertException e) {}
我会收到一个driver=null
感谢您的宝贵时间
【问题讨论】:
标签: exception selenium unhandled-exception