UITestControl.SearchProperties 属性

获取用于标识控件的属性-值对集合。

命名空间:  Microsoft.VisualStudio.TestTools.UITesting
程序集:  Microsoft.VisualStudio.TestTools.UITesting(在 Microsoft.VisualStudio.TestTools.UITesting.dll 中)

语法

声明
Public ReadOnly Property SearchProperties As PropertyExpressionCollection
    Get
public PropertyExpressionCollection SearchProperties { get; }
public:
property PropertyExpressionCollection^ SearchProperties {
    PropertyExpressionCollection^ get ();
}
member SearchProperties : PropertyExpressionCollection
function get SearchProperties () : PropertyExpressionCollection

属性值

类型:Microsoft.VisualStudio.TestTools.UITesting.PropertyExpressionCollection
用于标识控件的属性-值对集合。

示例

WinButton saveButton = new WinButton(window);
saveButton.SearchProperties.Add(WinProperties.Button.Name, “btnSave”);

如果您要使用 Contains 运算符

WinButton saveButton = new WinButton(window);
//If the name of the button contains “Save”, then it will be found.
saveButton.SearchProperties.Add(WinProperties.Button.Name, “Save”, PropertyExpressionOperator. Contains);

生成类似于下列的代码:

Public WinButton BtnSaveButton
{
   get
   {
      if ((this.mBtnSaveButton == null))
         {
            this.mBtnSaveButton = new WinButton(this);
#region Search Criteria
            this.mBtnSaveButton.SearchProperties[WinProperties.Button.Name] = "btnSave";
#endregion
         }
return this.mBtnSaveButton;
   }
}

.NET Framework 安全性

请参见

参考

UITestControl 类

Microsoft.VisualStudio.TestTools.UITesting 命名空间