UITechnologyManager.Search 方法

搜索父元素中与所提供查询 ID Cookie 的条件匹配的元素。

命名空间:  Microsoft.VisualStudio.TestTools.UITest.Extension
程序集:  Microsoft.VisualStudio.TestTools.UITest.Extension(在 Microsoft.VisualStudio.TestTools.UITest.Extension.dll 中)

语法

声明
Public MustOverride Function Search ( _
    parsedQueryIdCookie As Object, _
    parentElement As IUITechnologyElement, _
    maxDepth As Integer _
) As Object()
public abstract Object[] Search(
    Object parsedQueryIdCookie,
    IUITechnologyElement parentElement,
    int maxDepth
)
public:
virtual array<Object^>^ Search(
    Object^ parsedQueryIdCookie, 
    IUITechnologyElement^ parentElement, 
    int maxDepth
) abstract
abstract Search : 
        parsedQueryIdCookie:Object * 
        parentElement:IUITechnologyElement * 
        maxDepth:int -> Object[] 
public abstract function Search(
    parsedQueryIdCookie : Object, 
    parentElement : IUITechnologyElement, 
    maxDepth : int
) : Object[]

参数

  • maxDepth
    类型:System.Int32
    一个 int,它指示要在控件层次结构中搜索的深度。

返回值

类型:array<System.Object[]
与查询匹配的元素的数组;如果未找到任何元素,则为 nullnull 引用(在 Visual Basic 中为 Nothing)。

实现

IUITechnologyManager.Search(Object, IUITechnologyElement, Int32)

异常

异常 条件
NotSupportedException

此实现不支持此方法。

若要处理此异常,测试框架使用 GetChildren 方法来遍历层次结构,并在每个元素上使用 MatchElement 方法来确定它是否与查询匹配。

备注

对实现者的说明

实现此方法是可选操作。 如果基础技术具有大量用于搜索和导航 UI 层次结构的 API,则实现此方法可以显著提高播放性能。 但是,您必须实现此方法或 MatchElement(UITechnologyElement, Object, Boolean%) 方法。

.NET Framework 安全性

请参见

参考

UITechnologyManager 类

Microsoft.VisualStudio.TestTools.UITest.Extension 命名空间

GetChildren(UITechnologyElement, Object)

MatchElement(UITechnologyElement, Object, Boolean%)

ParseQueryId

UITechnologyElement