我得用这个方法
public boolean isElementPresent(By by) {
return driver.findElements(by).size()!=0;
}但必须使用@FindBy
public static final String addColorText="Add a color";
@FindBy(linkText = Data.ProductDetailData.addColorText)
protected By addColorPresent;当调用这个
if (common.isElementPresent(addColorPresent))获取NullpointerException(by将为null)。我可以使用FindBy按对象返回吗?任何输入请
发布于 2015-10-17 23:33:20
我想你要的是
public static final String addColorText = "Add a color";
@FindBy(linkText = addColorText)
protected By addColorPresent = By.linkText(addColorText);https://stackoverflow.com/questions/33174876
复制相似问题