LeanFT with Java
Introduction Supported applications Installation of LeanFT and plugins for IDEs Installing browser Extensions LeanFT settings,Object identification Center Understanding LeanFT SDK API Installing the LeanFT jar files in Maven Repository Creating LeanFT Maven Project Creating LeanFT Project with Gradle and TestNG LeanFT Properties Setting up LeanFT project in IntelliJ IDEA Creating maven project with JUnit with LeanFT in Eclipse Creating maven project with TestNG in Eclipse Description programming Application model Using regular expression in property values First web application test Identifying the Web elements using XPATH and CSS Identifying objects using Visual Relational Identifiers – VRI Handling embedded browser control in Windows app Firing events on Web Elements using LeanFT Executing JavaScript in web page Automating standard windows application Automating Java Application Automating WPF applicationsAutomating SAP Application Synchronization in LeanFT Assertions in LeanFTLeanFT with Cucumber Keyword Driven frameworks Data Driven Frameworks Converting the UFT Object Repository to Application models in LeanFTChallenges of LeanFT automation Working with third party objects using Native Object properties and methods LeanFT common issues and solutionsLeanFT Java ReferencesAutomating windows apps in leanft in Java
To automate the standard windows apps, you will need to import below packages in LeanFT project. Here is the sample application that launches the notepad and enters text in it. Then it tries to close the notepad. After that it clicks on Don’t save button on the Dialog box.
com.hp.lft.sdk.stdwin
package leanft;
import com.hp.lft.sdk.Desktop;
import com.hp.lft.sdk.stdwin.*;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class NotepadTest extends BaseTest {
@Test
public void test() throws Exception{
new ProcessBuilder("C:\Windows\System32\notepad.exe").start();
Thread.sleep(3000);
Window notepadWin = Desktop.describe(Window.class,
new WindowDescription.Builder().windowTitleRegExp("Notepad").build());
Editor editor = notepadWin.describe(Editor.class,
new EditorDescription.Builder().nativeClass("Edit").windowClassRegExp("Edit").build());
editor.sendKeys("This is automated text");
Thread.sleep(3000);
notepadWin.close();
Desktop.describe(Window.class, new WindowDescription.Builder()
.ownedWindow(false).childWindow(false).windowClassRegExp("Notepad").windowTitleRegExp(" Notepad").build())
.describe(Dialog.class, new DialogDescription.Builder()
.ownedWindow(true).childWindow(false).text("Notepad").nativeClass("#32770").build())
.describe(Button.class, new ButtonDescription.Builder()
.text("Do&n't Save").nativeClass("Button").build()).click();
}
}
Web development and Automation testing
solutions delivered!!