Resolve Function




Finds an object using the locator in the window declaration.


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


WINDOW result = window.Resolve ([options])
Variable Description
options Optional: Specifies options for the Resolve operation. Use to override the default timeout value or to specify whether an E_WINDOW_NOT_FOUND exception is thrown if no object is found (default) or if NULL is returned if no object is found.


  • Returns the first object that matches the locator. As long as no object matches the locator, the agent tries to find an object until the default timeout, which is specified by the option OPT_WINDOW_TIMEOUT, expires. If no object is found an E_WINDOW_NOT_FOUND exception is thrown.

  • The Resolve function returns a handle for the first matching object, which is only valid as long as the object in the application exists. For example, a handle to a button on a dialog is invalid once the dialog is closed. Any attempts to execute functions on this handle after the dialog 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 the order of execution, get new handles for the objects in each test case.

  • Resolve is similar to the Find function. Resolve uses the locator from the window declaration rather than using an XPath locator as a parameter.


[-] testcase ResolveExamples()
	[ ] WINDOW checkBoxMenu = TestApplication.Control.CheckBox.Resolve()
	[ ] checkBoxMenu.Pick()
	[ ] Verify(checkBoxMenu.GetCaption(), "Check box")
	[ ] TestApplication.Find("//DialogBox").Close()
	[ ]             
	[ ]  // finds the first menuitem
	[ ]  WINDOW firstMenuItem = TestApplication.AllMenuItems.Resolve()
	[ ]  Verify(firstMenuItem.GetCaption(), "New")