【问题标题】:UIAutomation - How to get around modal dialog blocking using windowopendedevent handler?UIAutomation - 如何使用 windowopenedevent 处理程序绕过模式对话框阻塞?
【发布时间】:2012-10-31 03:10:42
【问题描述】:

我正在尝试为我们的一个产品构建一个自动化测试框架。一些测试用例涉及在模态对话框中执行自动化。但是,模式对话框会阻止 UIAutomation 代码执行。换句话说,如果我有一个由 UIAutomation 打开的模态对话框,那么在我关闭模态对话框之前什么都不会发生。

为了在显示模式对话框时执行 UIAutomation 代码,我一直在尝试注册一个 windowopenedevent 处理程序,该处理程序在模式对话框打开时捕获它,因此我可以在 windowopenedevent 处理程序中执行其余测试。但是,处理程序根本没有捕获事件。我不知道哪里出了问题,有什么建议吗?

也欢迎针对此场景的其他解决方法。

【问题讨论】:

    标签: modal-dialog microsoft-ui-automation


    【解决方案1】:

    我遇到过几次,通常是在浏览器测试中。

    我所做的是这样的:

    >> before taking the action that causes the modal dialog to show up:
       >> start another thread (OR) launch a script asynchrounously
       >> then take the action
    
    >> In the other thread or script:
        >> Sleep for 5 seconds or so
        >> Activate the dialog
        >> send keystrokes or call UI auto methods to dismiss the dialog
    

    一旦对话框关闭,您的测试应该会解除阻塞。

    这一直对我有用。

    【讨论】:

      猜你喜欢
      • 2011-04-22
      • 1970-01-01
      • 1970-01-01
      • 2010-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-17
      • 1970-01-01
      相关资源
      最近更新 更多