Element identification in leanft in Java

We can use XPATH and CSS selectors to identify the web elements. Below example illustrates how to use XPATH and CSS in LeanFT. In below example, we have identified edit box using XPATH and CSS. For more advanced XPATH expressions, you can visit – https://selenium-interview-questions.blogspot.in/2014/02/how-to-identify-elements-using-xpath-in.html For more advanced CSS expressions, you can visit – https://selenium-interview-questions.blogspot.in/2014/02/how-to-identify-elements-using.html
package leanft;

import com.hp.lft.report.Reporter;
import com.hp.lft.report.Status;
import com.hp.lft.sdk.web.*;
import org.junit.Test;

public class CssXpathTest extends BaseTest {

    public void test() throws Exception{

        Browser browser = BrowserFactory.launch(BrowserType.CHROME);
            //Navigate to https://www.softpost.org/selenium-test-page/

            //set value in edit box using xpath
            browser.describe(EditField.class,new EditFieldDescription.Builder()

            //set value in edit box using css
            browser.describe(EditField.class,new EditFieldDescription.Builder()

        catch(AssertionError ex){
           //Report the Exception
           Reporter.reportEvent("Exception","Test failed", Status.Failed, ex);
           throw ex;
            //Close the browser

Web development and Automation testing

solutions delivered!!