Bagikan melalui


UITechnologyManager.Search Method

Searches for an element in the parent element that matches the condition of the provided query ID cookie.

Namespace:  Microsoft.VisualStudio.TestTools.UITest.Extension
Assembly:  Microsoft.VisualStudio.TestTools.UITest.Extension (in Microsoft.VisualStudio.TestTools.UITest.Extension.dll)

Syntax

'Declaration
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[]

Parameters

  • parsedQueryIdCookie
    Type: Object

    A query cookie that was previously parsed by using the ParseQueryId method.

  • maxDepth
    Type: Int32

    An int that indicates how deep into the control hierarchy to search.

Return Value

Type: array<Object[]
An array of elements that match the query, or nulla null reference (Nothing in Visual Basic) if no elements are found.

Implements

IUITechnologyManager.Search(Object, IUITechnologyElement, Int32)

Exceptions

Exception Condition
NotSupportedException

This implementation does not support this method.

To process this exception, the test framework uses the GetChildren method to traverse the hierarchy, and uses the MatchElement method on each element to determine whether it matches the query.

Remarks

Notes to Implementers

Implementing this method is optional. If the underlying technology has rich APIs for searching and navigating the UI hierarchy, implementing this method could significantly improve the playback performance. However, you must implement either this method or the MatchElement method.

.NET Framework Security

See Also

Reference

UITechnologyManager Class

Microsoft.VisualStudio.TestTools.UITest.Extension Namespace

GetChildren

MatchElement

ParseQueryId

UITechnologyElement