在Coded UI中处理UITestControls上的事件 [英] Handle events on UITestControls in Coded UI

查看:78
本文介绍了在Coded UI中处理UITestControls上的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在Coded UI中处理UITestControls上的事件吗?就像我想对文本框文本更改事件执行操作。我想在文本框填充时获取文本?

Can we handle events on UITestControls in Coded UI. Like I want to perform an operation on a text box text changed event. I want to fetch the text from text box whenever it gets populated?

推荐答案

Hi Sumit Parab,

感谢您的发布。

根据您的描述,您希望从文本框中获取文本得到人口。我建议您使用If语句进行检查,如果文本框中有值,则获取它。

您可以使用自定义编码的UI测试,这是用于测试WPF文本框的代码片段:

WpfEdit mUITextBoxEdit = new WpfEdit();

mUITextBoxEdit.SearchProperties[WpfEdit.PropertyNames.AutomationId] = "textBox";

mUITextBoxEdit.Find();

if (mUITextBoxEdit.Text!=null)

{

     Console.WriteLine(mUITextBoxEdit.Text.ToString());

}

else

{

     Console.WriteLine("There's no text");

} 

 

最好的问候,

Fletcher


这篇关于在Coded UI中处理UITestControls上的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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