javaselenium-webdriverpageobjectsleanft

Page Object model in Leanft - Initialize elements


I use TestNG in LeanFT. I created separated classes for pages and identified objects as it shown in code snippet below:

public class HomePage {
    private Browser browser;

    public HomePage(Browser browser) throws GeneralLeanFtException {
        this.browser = browser;
    }

    Button sendButton = browser.describe(Button.class, new ButtonDescription.Builder()

I can't initialize web elements in test class, failed to use PageFactory, because got NullPointerException.

PageFactory.initElements(browser, page);

Solution

  • This project contains template to work with LeanFT and TestNG: https://github.com/kohli-harshit/leanft-testng-template

    LeanFT SDK and Report initialization
    Logging with Log4J
    Utils to Read from Properties File
    Utils to Create Data Driven Tests from CSV Data
    TestNG listeners used