编码ui测试:WaitForControlExist()不起作用 [英] coded ui test: WaitForControlExist() does not work

查看:106
本文介绍了编码ui测试:WaitForControlExist()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编码ui测试中,我想将超时设置为60s以定位控件。我使用WaitForControlExist(60 * 1000),但它总是在20秒左右超时。如何将超时设置为60秒?

in coded ui test, i wanna set the timeout as 60s for locate a control. i used WaitForControlExist(60*1000), but it always timeout around 20s. how can i set the timeout to 60s?

谢谢

推荐答案

嗨imeya,

Hi imeya,

WaitForControlExist()用于阻止当前线程,直到在用户界面中发生此控制,或者直到超时到期为止。这意味着如果控件被发现少于60秒,则此行代码将执行完毕。

The WaitForControlExist() used to blocks the current thread until this control occurs in the user interface, or until the time-out expires. This is means if the control is found less than 60s, this line of code will be execute complete.

如果要为控件设置搜索超时,请使用PlaybackSettings.SearchTimeout和在搜索控件之前,PlaybackSettings.ShouldSearchFailFast。

If you want to set searching time out for a control, please use PlaybackSettings.SearchTimeout and PlaybackSettings.ShouldSearchFailFast before search the control.

 BrowserWindow window = BrowserWindow.Launch(new Uri("http://www.google.com"));

 Playback.PlaybackSettings.SearchTimeout = 60 * 1000;
 Playback.PlaybackSettings.ShouldSearchFailFast = false;

 UITestControl text = new UITestControl(window);
 text.SearchProperties.Add("Name", "q");
            
 text.DrawHighlight();

最好的问候,

Weiwei

Best Regards,
Weiwei


这篇关于编码ui测试:WaitForControlExist()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆