【发布时间】:2020-08-31 17:53:56
【问题描述】:
我正在为我的自动化框架使用PageFactory 页面对象模型。现在对于每个页面类,我必须创建一个构造函数。例如:
public class StudentProfile {
public StudentProfile (WebDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
}
但我想创建一个自定义注释。这样我就不必为每个Page Class一次又一次地重复它
@InitElements(driver)
public class StudentProfile {
// to do
}
@InitElements(driver)
public class SchoolHomePage {
// to do
}
我已经完成了 tuts,但不明白我将如何实现它?
【问题讨论】:
标签: java annotations retention