我在使用WatiN处理Win7中的Windows安全弹出窗口时遇到问题。我正在尝试从这里解决方案: [1]:WatiN LogonDialogHandlers not working correctly in Windows 7(最后一个答案)。请不加修改地使用代码,我的电话:
Ie.DialogWatcher.Add(new Windows7LogonDialogHandler(user, passw));
Ie.GoTo(url);
但得到错误:
Exception was thrown while DialogWatcher called HandleDialog: System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
此时:
var another = (from AutomationElement list in lists
where list.Current.ClassName == "UserTile"
where list.Current.Name == "Use another account"
select list).First();
我错过了什么?