我在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()
我无法在测试类中初始化Web元素,无法使用PageFactory
,因为NullPointerException
.
PageFactory.initElements(browser, page);
该项目包含与 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