Automating Java apps in leanft in Java

Automating the Java applications is just like that of Standard windows applications. Only difference is that you need to import classes in below package. Here is the sample example that identifies the Java window with title – XYZ and then clicks on the check box with attached text as “Gender” inside a frame.
 
import com.hp.lft.sdk.java.*;


package leanft;

import com.hp.lft.sdk.CheckedState;
import com.hp.lft.sdk.Desktop;
import com.hp.lft.sdk.java.*;
import org.junit.Test;

public class JavaTest extends BaseTest  {

    @Test
    public void test() throws Exception {


        Window javaWin = Desktop.describe(Window.class, new WindowDescription.Builder()
                .title("XYZ").build());

        CheckBox checkBox = javaWin.describe(InternalFrame.class, new InternalFrameDescription.Builder()
                .title("Frame1").build()).describe(CheckBox.class, new CheckBoxDescription.Builder()
                .attachedText("Gender").build());

        checkBox.setState(CheckedState.CHECKED);

    }
} 

Web development and Automation testing

solutions delivered!!