WaitUntil method in LeanFT | UFT Developer

Synchronization is a very important aspect of testing if you want to make your test scripts robust and efficient. The WaitUntil method in LeanFT now known as UFT Developer is the most effective way to wait for an object until a certain condition is met during execution rather than using hard wait. The following example illustrates how to use waitUntil method in LeanFT (UFT Developer) to dynamically wait for an expected condition to be met. In this example, the dynamic wait is being used to wait until the Sign-In image button exists and it becomes visible when the URL for the Home page is opened.

WaitUntil Method in LeanFT

Example of WaitUntil Method in LeanFT |UFT Developer

Code Explanation

First of all, I have created an object of the Image button for what I want to use dynamic wait.

For the dynamic wait, we will have to use the waitUntil method of WaitUntilTestObjectState class. The waitUntil method requires two parameters, first one the object for which you want to wait. In this case, it is signInImage.For the next one follow the syntax as mention in the code and provide appropriate object type in all places. In this example, I have an Image type of object. If you want to waitUntil for another object type like web element, you can use the “WebElement” object.

Now inside the evaluate() method, I have added conditions to check the existence of the Image button and its visibility. If you want you can add more conditions or other conditions.

Recommended Posts

Leave a Reply