codedUi:如何去有关窗口的搜索属性时,其标题名称不断变化? [英] CodedUi :How to go about for search property of window when its title name keeps changing?

查看:245
本文介绍了codedUi:如何去有关窗口的搜索属性时,其标题名称不断变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在自动窗内控制点击,并根据是什么窗口内选择,窗口changes.Like的瓦片有时是ABC,第二次将是123。有在窗口的标题没有共同的字符串两种情况

I am trying to automate a click on control within window, and depending on what is selected within window, the tile of the window changes.Like sometime it is "abc",second time it will be "123".There is no common string in window title for two scenarios

当我录制的codeD UI测试,它承担的标题ABC。现在我想以某种方式自定义测试,所以任何标题将正常工作。

When I recorded the coded ui test, it assumed the title as "abc". Now I want to customize the test somehow, so that any title will work.

我怎么可以这样做?

任何帮助将是巨大的。

推荐答案

您可以更改searchProperties在运行时,像这样的:

You can change the searchProperties in runtime, like this:

myUITestControl.SearchProperties.Remove(UITestControl.PropertyNames.Name);
myUITestControl.SearchProperties.Add(UITestControl.PropertyNames.Name,123);

myUITestControl.SearchProperties.Remove(UITestControl.PropertyNames.Name); myUITestControl.SearchProperties.Add(UITestControl.PropertyNames.Name, "123");

控件首先搜索之前,此应该做的。因此,也许在你的测试类的构造函数。 (或者你也可以加入AlwaysSearch到UITestControl的SearchConfigurtation)

This should be done before the control is first searched. So maybe in the ctor of your test-class. (alternatively you can also add "AlwaysSearch" to the UITestControl's SearchConfigurtation)

问候
约翰内斯

Greetings Johannes

这篇关于codedUi:如何去有关窗口的搜索属性时,其标题名称不断变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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