我在等待控件存在,但在按钮存在之前测试失败。
它给出了错误:The control is not available or not valid
我使用的代码是:
uIOKButton.WaitForControlExist(2000000);
// Click 'OK' button
Mouse.Click(uIOKButton, new Point(46, 19));
超时,即使我将其设置为 3 小时,也会在 30 分钟后超时。所以超时没有按照预期的方式工作。周围有没有?
除了增加超时之外,还有什么办法可以阻止它失败吗?
最佳答案
我是这样做的:
while (!uIItemComboBox.Exists)
{
System.Threading.Thread.Sleep(1000);
}
uIItemComboBox.SelectedItem = this.MyComboBox.UIItemComboBoxSelectedItem;
我确信有更好的方法,但它确实有效。
关于c# - CodedUI 测试不等待控件存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11737254/