UITestControl.SearchProperties Property

Gets the property-value pair collection that is used to identify a control.

Namespace:  Microsoft.VisualStudio.TestTools.UITesting
Assembly:  Microsoft.VisualStudio.TestTools.UITesting (in Microsoft.VisualStudio.TestTools.UITesting.dll)


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

Property Value

Type: Microsoft.VisualStudio.TestTools.UITesting.PropertyExpressionCollection
The property-value pair collection that is used to identify a control.


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

If you want to use Contains operator

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);

The generated code will be similar to the following:

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

.NET Framework Security

See Also


UITestControl Class

Microsoft.VisualStudio.TestTools.UITesting Namespace