0

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

有什么想法?

上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秒。

在此先感谢

+0

编辑问题以给出问题的更多细节是很好的。您还应该添加关于找到问题解决方案所做的研究的详细信息。我的回答提出了一些需要调查的地方。遵循这些建议你学到了什么? – AdrianHHH

回答

0

的代码是不太可能

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对于加快编码UI测试的一些好主意。

+0

谢谢,但再试一次 – xavilage