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

其他资源

如何:在编码的 UI 测试中使用 UI 控件操作和属性