UITestControl.GetProperty Method

Gets the value of the specified property.

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

Syntax

'Declaration
Public Function GetProperty ( _
    propertyName As String _
) As Object
public Object GetProperty(
    string propertyName
)
public:
Object^ GetProperty(
    String^ propertyName
)
member GetProperty : 
        propertyName:string -> Object
public function GetProperty(
    propertyName : String
) : Object

Parameters

  • propertyName
    Type: String

    The name of the property from which to retrieve a value.

Return Value

Type: Object
The value of the given property as an Object. The Object must be cast to the appropriate data type.

Remarks

To access the properties of a UITestControl (for example, to get the count of items in a ListBox or to set the text on a button) you must use GetProperty and SetProperty to get and set the specific properties of the UITestControl. The propertyName parameter specifies the property to access.

To get the count of items in an HtmlList, use GetProperty together with the parameter ItemCount.

.NET Framework Security

See Also

Reference

UITestControl Class

Microsoft.VisualStudio.TestTools.UITesting Namespace

HtmlList

ItemCount

Other Resources

How to: Use UI Control Actions and Properties in Your Coded UI Tests