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 ReferencesSynchronization 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{
@Test
public void test1() throws Exception{
WaitUntilTestObjectState.WaitUntilEvaluator<Window> evaluator = new WaitUntilTestObjectState.WaitUntilEvaluator<Window>() {
@Override
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());
notepadWindow.maximize();
Assert.assertTrue(evaluator.evaluate(notepadWindow));
}
}
Web development and Automation testing
solutions delivered!!