简体   繁体   English

C#CodedUI:无法找到控件

[英]C# CodedUI:Unable to find controls

I am finding it strange that I'm unable to find the control if I set Playback.PlaybackSettings.SearchTimeout , if I remove then it`s finding the control I want. 我感到奇怪的是,如果我设置了Playback.PlaybackSettings.SearchTimeout ,我找不到控件,如果我删除了它,那就找到了我想要的控件。

Below is my code: 下面是我的代码:

Playback.PlaybackSettings.SearchTimeout=5000;

WinTabPage tab=new WinTabPage();
this.Tab = new WinTabPage(this);
this.Tab.SearchProperties[WinWindow.PropertyNames.Name] = "Some Tab";
Tab.WaitForControlEnabled(3000);
Mouse.Click(Tab);

Error I`m getting is: Playback failed to find the control with the given search properties. 我得到的错误是:播放未能找到具有给定搜索属性的控件。

But the same works if remove searchTimeOut which I have set. 但是,如果删除我设置的searchTimeOut ,则同样有效。

The search timeout property on Playback settings determines the max amount of time coded ui engine will search for a contorl before failing the test with exception. 回放设置上的搜索超时属性确定在异常测试失败之前,编码的ui引擎将搜索控制的最大时间。

it's in miliseconds - so for your example you define max 5 sec search time. 以毫秒为单位-因此,在您的示例中,您定义了最长5秒的搜索时间。

the default value is 2 minutes. 默认值为2分钟。

try this slide share for more information: advanced Codedui slide share 试试此幻灯片共享以获取更多信息: 高级Codedui幻灯片共享

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM