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 中的項目計數,請將 GetProperty 與參數 ItemCount 一起使用。

.NET Framework 安全性

請參閱

參考

UITestControl 類別

Microsoft.VisualStudio.TestTools.UITesting 命名空間

HtmlList

ItemCount

其他資源

HOW TO:在您的自動程式碼 UI 測試中使用 UI 控制項動作和屬性