Synchronization in leanft in Java

By default, LeanFT will wait for 20 seconds when trying to find the objects. If it doesn’t identify the object withing 20 seconds, exception is thrown. You can change this timeout from LeanFT settings dialog. Additionally you can also add custom wait conditions.
package leanft;

import com.hp.lft.sdk.GeneralLeanFtException;
import com.hp.lft.sdk.*;
import com.hp.lft.sdk.stdwin.ToolBar;
import com.hp.lft.sdk.stdwin.Window;
import com.hp.lft.sdk.stdwin.WindowDescription;
import org.junit.Assert;
import org.junit.Test;

 * Created by Sagar on 21-07-2016.
public class SynchTest extends BaseTest{

    public void test1() throws Exception{
        WaitUntilTestObjectState.WaitUntilEvaluator<Window> evaluator = new WaitUntilTestObjectState.WaitUntilEvaluator<Window>() {
            public boolean evaluate(Window testObject) throws GeneralLeanFtException {
                return testObject.getWindowState()==WindowState.MAXIMIZED;
        new ProcessBuilder("C:\Windows\System32\notepad.exe").start();

        Window notepadWindow = Desktop.describe(Window.class,
                new WindowDescription.Builder().windowClassRegExp("Notepad").windowTitleRegExp("Notepad").build());

Web development and Automation testing

solutions delivered!!