0
@FindBy()
にSelenium webdriverのオブジェクトリポジトリのファイル.properties
を使用しています。@FindBy定数の.propertiesファイルのコンパイル方法
@FindBy
には初期化するための定数が必要なため、エラーが発生します。
.properties
ファイルをコンパイルする方法はありますか?
コードスニペット:
public class LoginPageID {
@FindBy(id=ObjectConstants.LOGINID)
public WebElement LoginID;
}
public class ObjectConstants {
public static final String LOGINID;
static {
Properties p = new Properties();
try {
p.load(new FileInputStream("constants.properties"));
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
LOGINID = p.getProperty("LOGINID");
}
}