FindAll Function


AnyWin class.


Finds all objects specified by an XPath locator.


This function is supported only in scripts that use the Open Agent and dynamic object recognition.


window.FindAll(locator [, options])
Variable Description
locator The XPath locator. Defines which objects to find. STRING.
options Optional: Specifies options for the FindAll operation. Use to override the default timeout value or to specify whether a E_WINDOW_NOT_FOUND exception is thrown if no object is found (default) or if NULL is returned if no object is found. FINDOPTIONS.


Returns all objects that match the locator. As long as no object matches the locator, the agent tries to find an object until the default timeout, specified by the option OPT_WINDOW_TIMEOUT, expires.

An E_INVALID_XPATH exception is thrown if the XPath locator is syntactically incorrect. You can record the XPath query string if necessary.

The FindAll function returns a handle for each matching object, which is only valid as long as the object in the application exists. For example, a handle to a button in a dialog box is invalid once the dialog box is closed. Any attempts to execute functions on this handle after the dialog box closes will throw an E_WINDOW_INVALIDATED exception. Since it is a common practice to design test cases to be independent of each other and of order of execution, get new handles for the objects in each test case. In order not to duplicate the XPath query, helper functions can be created.


LIST OF WINDOW textFields = myWindow.FindAll(".//TextField”)