对话框在 60 秒内不可用
我试图在一个函数中使用两次对话框处理程序。 第一次它执行得很好,但第二次它挂起系统,对话框打开并显示“确定”和“取消”按钮,但永远无法单击它。 它还超时并出现错误“对话框在 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 个位置使用此命令,第一次执行正常,第二次在同一函数中执行时给出对话框不可用而可用的错误。
I am trying to use Dialog handler twice in a function. For first time it executes well but on second time it hangs the system with dialog box open and showing Ok and Cancel butoon but never able to click it. Also it times out with an error "Dialog not available within 60 seconds"
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
Using this at 2 places in my code, First time it executes fine and second time within same function it gives dialog not available whereas it is available error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最好的猜测是在第二遍中你再次打电话
ie.AddDialogHandler(cdhPopup),从而第二次注册它,这会在调用处理程序时以某种方式使程序崩溃(也许跨线程访问内部变量?)
您应该检查处理程序是否已注册,只有未注册时才注册。
My best guess is that in the second pass you are again calling
ie.AddDialogHandler(cdhPopup)
, thereby registering it a second time, which is somehow crashing the program when the handlers are invoked (cross thread access to internal variables maybe?)You should perform a check if the handler is registered, and only register it if it isn't.