【问题标题】:uiitem.WaitForControlExist(milliseconds); Waits too longuiitem.WaitForControlExist(毫秒);等待太久
【发布时间】:2014-01-21 11:04:27
【问题描述】:

当我使用方法 uiitem.WaitForControlExist(milliseconds);执行等待时间过长。更多的指定参数。

有什么想法吗?

只是 UIMap.cs 文件中的一个示例:

public void AnyAlertClickNo(int seconds)
{
    #region Variable Declarations
    WinWindow uIAlert = this.UIAlertWindow;
    WinButton uINoButton = this.UIAlertWindow.UIAnswerPanel.UINoButton;
    #endregion

    if(uIAlert.WaitForControlExist(seconds*1000)){
        Mouse.Click(uINoButton, new Point(20, 10));
    }

}

电话可能是:

Any_UIMap aaa = new Any_UIMap();
aaa.AnyAlertClickNo(3);

我不知道为什么这段代码要等待这个警报大约 15-20 秒。

提前致谢

【问题讨论】:

  • 编辑问题以提供问题的更多细节是好的。您还应该添加您为找到问题的解决方案所做的研究的详细信息。我的回答建议了一些领域供您调查。您从这些建议中学到了什么。

标签: testing visual-studio-2012 automated-tests ui-automation coded-ui-tests


【解决方案1】:

代码不太可能

uiitem.WaitForControlExist(milliseconds);

UI控件往往有好几级,所以代码更可能是这样的形式:

UiMap.uiOne.uiTwo.uiThree.WaitForControlExist(milliseconds);

如上一行的含义如下,前提是它首先使用了三个UI控件:

var one = UiMap.uiOne.Find();
var two = one.uiTwo.Find();
two.uiThree.WaitForControlExist(milliseconds);

我怀疑您的 Coded UI 测试在 ...Find() 调用上花费了一些时间。您可能会做一些诊断来检查时间花在哪里。查看 herehere 了解加速 Coded UI 测试的一些好主意。

【讨论】:

    【解决方案2】:

    应该是这样的。 UITestControl.WaitForControlExist Method (Int32)

    当等待操作导致隐式搜索控件时,或者当应用程序繁忙时,实际等待时间可能超过指定的超时时间。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-26
      • 2015-09-13
      • 2011-07-03
      • 1970-01-01
      • 1970-01-01
      • 2021-08-24
      • 2020-04-06
      • 1970-01-01
      相关资源
      最近更新 更多