Slowing Down Tests

Some applications under test might require extensive loading of application data in the UI, and might not be finished on time with loading objects that are required for replaying a test. To successfully replay tests on such an AUT, you can check for the existence of an object before performing an action on it, or you can add sleeps before performing an action.

Note: Micro Focus does not recommend generally adding sleeps to tests, because in most cases Silk4J will automatically detect if an object is available, and sleeps might severely reduce the performance of tests.
  1. To check if an object is available in the AUT, use the exists method. For example, to wait for six seconds for the button INPUT to become available, add the following line to your test script:
    browserWindow.exists("//INPUT", 6000);
  2. To add a sleep before performing an action on a control, use the sleep method. For example, to sleep for six seconds, add the following line to your test script:

For additional information on these methods, see the Javadoc.