本文介绍了如何通过2个搜索属性找到控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

如果我的假设错了,请纠正我。根据我的假设,如果我们使用搜索属性,那么编码用户界面将通过在它们之间使用AND运算符找到对象,如果我们使用Filter属性,那么它将通过在它们之间使用OR运算符来找到对象。
我尝试一个例子来确认我的假设,并在Web应用程序中使用了EditBox对象的ID和Name属性。我可以看到两个属性值都是"txtCompany"。在测试生成器工具的帮助下。我将ID设置为"txtCompany"和名称为"XYZ"在我的代码中。
根据我对Coded UI的假设,如果我将ID和Name属性设置为搜索属性,我应该给出错误消息,但令我惊讶的是Coded UI能够找到EditBox对象并能够对其执行操作。我的假设是错误的,对于Search
Property Coded UI会在它们之间使用AND运算符找到对象,对于Filter Property,它会通过在它们之间使用OR运算符来找到对象吗?代码是这样的:

BrowserWindow sBrowser = BrowserWindow.Launch(new System.Uri(< Application URL>));

Please correct me if my assumption is wrong. As per my assumption if we use Search Property then Coded UI will find the object by using AND operator between them and if we use Filter Property then it will find the object by using OR operator between them. I try a example to confirm my assumption and I used ID and Name property of EditBox object in a web application. I can see both property value as "txtCompany" with the help of test builder tool. I am setting ID as "txtCompany" and Name as "XYZ" in my code. According to my assumption of Coded UI should give me error message if I set both ID and Name property as Search Property but to my surprise Coded UI is able to find the EditBox object and able to perform action on it. Is my assumption wrong that for Search Property Coded UI will find the object by using AND operator between them and for Filter Property it will find the object by using OR operator between them? Code is like this:
BrowserWindow sBrowser = BrowserWindow.Launch(new System.Uri(<Application URL>));

HtmlEdit sEdit = new HtmlEdit( sBrowser);

HtmlEdit sEdit = new HtmlEdit(sBrowser);

sEdit.SearchProperties.Add("Id","txtCompany","Name","XYZ");

sEdit.SearchProperties.Add("Id", "txtCompany", "Name", "XYZ");

sEdit.SetProperty(" Text"," Microsoft");

sEdit.SetProperty("Text", "Microsoft");

谢谢

Ghost

推荐答案

请查看
博客帖子可以帮助您。

Please see if this blog post helps you.

问候,

Pankaj


这篇关于如何通过2个搜索属性找到控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 12:00