WaitForObject Method

Class

AnyWin class.

Action

Waits for an object that matches the specified XPath locator.

Availability

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

Syntax

WaitForObject (locator, [timeout])
Variable Description
locator The XPath locator. Defines which object to find. STRING.
timeout Optional: Number of seconds that Silk Test Classic waits for the XPath locator string to appear. If the initial Find operation does not locate an object, the agent tries to find an object until the timeout expires. NUMBER.

Notes

If no object is found before the timeout occurs, an E_WINDOW_NOT_FOUND exception is thrown. The default timeout value is the value of the option OPT_WINDOW_TIMEOUT.

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

Example

Desktop.WaitForObject(“.//Dialog[@caption=’Information’]”)