共用方式為


UITestControl.GetProperty 方法

取得指定之屬性的值。

命名空間:  Microsoft.VisualStudio.TestTools.UITesting
組件:  Microsoft.VisualStudio.TestTools.UITesting (在 Microsoft.VisualStudio.TestTools.UITesting.dll 中)

語法

'宣告
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

參數

  • propertyName
    型別:System.String
    要從中擷取值之屬性的名稱。

傳回值

型別:System.Object
型別為 Object 之指定的屬性的值。Object 必須轉型為適當的資料型別。

備註

若要存取 UITestControl 的屬性,例如取得清單方塊中項目的計數,或在按鈕上設定文字,您必須使用 GetProperty 和 SetProperty 以取得並設定 UITestControl 的特定屬性。propertyName 參數會指定要存取的屬性。

若要取得計算 HtmlList的項目,請將參數 ItemCount一起使用 GetProperty 。

.NET Framework 安全性

請參閱

參考

UITestControl 類別

Microsoft.VisualStudio.TestTools.UITesting 命名空間

HtmlList

ItemCount

其他資源

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