共用方式為


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 命名空間