Leanft中的页面对象模型 - 初始化元素

时间:2018-05-15 12:13:56

标签: java selenium-webdriver pageobjects leanft

我在LeanFT中使用TestNG。我为页面和已识别的对象创建了分隔的类,如下面的代码片段所示:

public class HomePage {
    private Browser browser;

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

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

我无法在测试类中初始化网页元素,但未能使用PageFactory,因为获得了NullPointerException

PageFactory.initElements(browser, page);

1 个答案:

答案 0 :(得分:-1)

此项目包含与LeanFT和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