Best Practices - Using Waits in Leapwork
Best Practices - Using Waits in Leapwork
When performing automation testing for an application, the test automation tool and the Application Under Test (AUT) shall work concurrently and in a synchronized manner. If these two components do not work concurrently, such as when the test automation tool is faster than the application, synchronization issues may occur. This can lead to exceptions like ElementNotVisibleException or NoSuchElementException. To avoid these synchronization issues, waits are used.
In Leapwork, various waits are implemented to handle synchronization issues typically seen in applications involving JavaScript and AJAX calls. These waits include:
Timeout(sec)
The Timeout property of the Web building blocks is a dynamic wait, meaning if the action is completed before the 10 seconds are up, the "success" connector will execute. This timeout frame is measured in seconds and should be used in scenarios where, for instance, you are opening a URL of a web page that takes 20 seconds to settle in the browser. If you set a timeout less than 20 seconds, the user will encounter a Timeout exception during the test run.
This wait is intelligent as it moves to the next block as soon as the element is found, rather than waiting for the entire timeout period to elapse. By default, the timeout value is set to 10 seconds.
Await DOM Change
This property ensures that the DOM of a page will settle before the operation intended in the Leapwork building block is executed. This action ensures that actions like "Click Web Element" are not rushed ahead, but wait for the web page to settle. The default timing value is 3 seconds, which may be adjusted based on the type of web application.
Await Not Found
This property, when checked, tells the building block to wait until the web element is no longer found on the page before proceeding. It's useful for waiting for elements like a "Loading..." message to disappear.
Await Requests
This property delays the search for the web element until there have been no active XHR requests for a specified period, such as 3 seconds. This is useful when waiting for behind-the-scenes updates with XHR to occur, commonly used in enterprise web applications like Microsoft Dynamics 365 and Salesforce.
If you have any questions, contact our Priority Support.