Purpose
This
document provides information on how to use the Invoke action to wait for a
window or object to be located and to receive a response from the window or
object before performing the next action.
About Invoke [waitFor]
This
is a special form of the invoke command that waits not only for the result, but
waits before that for the object, or window, to be findable. The action requires
you to specify a timeout (in milliseconds) that is a total for first finding the
object and then getting the proper response from it. When simply waiting for a
component to become visible, the
isVisible method with an expected value of true can be used. Note that
once a qualifying object is found, it is used for the method call. If the method
call does not produce the desired result and there is more time, the same object
will be used for a subsequent call. Another object search is not performed.
The
waitFor
method is available by using the Invoke action in the Certify Process editor.
The Invoke action requires that you specify parameters for the method and up to
five arguments. The method in this case is
waitFor.
In the Argument fields, you specify the parameters for the
waitFor
method.
For
example:
- In the Optional Argument 1 field, you would type the
Timeout value for the waitFor method
- In the Optional Argument 2 field, you would type the
Expected Value for the waitFor method
- In the Optional Argument 3 field, you would type the name
of the Method that will be executed against the window or object until the
waitFor parameters (Arguments 1 and 2) are found
- In the Optional Argument 4 and 5 fields, you would type the
arguments for the method you specified in Optional Argument 3. Since there are
only two argument fields for this method, in the last argument field you can use
a space between the argument values to add more
arguments.
Parameters
The parameters for the waitFor method are described below.
TIMEOUT - the number of
milliseconds to wait for the object to be found and the method on it to return
the EXPECTED-VALUE.
EXPECTED VALUE - the value the
METHOD must return to end the wait, as a string.
METHOD - the method on the
object that returns the EXPECTED-VALUE as a signal that the wait should
terminate.
METHOD ARGUMENT - arguments to
METHOD. If the method takes no arguments then these values will be absent.
Result Returned
If the expected result is not obtained by the end of the
timeout period, the waitFor
action will time out and the step will show as Failed.
Sample Usage
The following is an example of how the Invoke [waitFor] method
can be used.
Let’s say we have a drawing application containing a page that
displays random pictures on the page. We want to verify that the color turns a
specific shade of red before continuing with the test. In Certify, we create our
process and specify the necessary steps up to the point where we want to wait
for the color of the page to change.
We start the Invoke step by selecting the application and the
window. For the action, we select Invoke.
The step is added and the parameters for the Invoke action are displayed. The
following parameters are needed to create our waitFor
method.
- In the Method field, we type waitFor.
-
In the Optional Argument 1 field, we type 25000 (milliseconds)
-
In the Optional Argument 2 field, we type 255 0 198 255 (RGB value and
opacity)
- In the Optional Argument 3 field, we type GetColor (method
to call)
-
In the Optional Argument 4 field, we type 499 498. (colors to match)
In Certify, the parameters specified above look like the
following:
