对话在60秒内无法使用

时间:2009-03-25 09:24:00

标签: visual-studio nunit watin

我试图在函数中使用Dialog处理程序两次。第一次它执行得很好,但第二次它挂起系统打开对话框,显示确定和取消但不能点击它。它也超时,出现错误“对话在60秒内不可用”

Dim cdhPopup As ConfirmDialogHandler 
cdhPopup = New ConfirmDialogHandler() 
If (ie.Button(Find.ById("btnDelete")).Exists) Then
    'Cancel the booking '
    ie.AddDialogHandler(cdhPopup) 
    ie.Button(Find.ById("btnDelete")).ClickNoWait() 
    cdhPopup.WaitUntilExists() 
    cdhPopup.OKButton.Click() 
    ie.WaitForComplete() 'Wait for page to finish loading '
Else 
    Assert.Fail("Could not found the Cancel Button") 
End If 

在我的代码中的2个位置使用它,第一次它在同一个函数中执行正常和第二次它给对话框不可用,而它是可用的错误。

1 个答案:

答案 0 :(得分:2)

我最好的猜测是,在第二次传球中,你再次打电话 ie.AddDialogHandler(cdhPopup),从而第二次注册它,当调用处理程序时,它会以某种方式崩溃程序(可能会对内部变量进行跨线程访问?)

您应该检查处理程序是否已注册,只有在处理程序未注册时才会注册。