2
我正在Selenium Web驱动程序中使用PageObjects模式,例如,在使用PageObjects和Selenium时检查是否存在IWebElement
var page = new CategoryPage(driver);
PageFactory.InitElements(driver, page);
return page;
当在页面望IsProductList
检查我总是返回true,甚至当我选择设置为ISN”类或CSS路径:
public class CategoryPage
{
private IWebDriver driver;
[FindsBy(How = How.CssSelector, Using = ".notFound")]
private IWebElement products;
public CategoryPage(IWebDriver webDriver)
{
driver = webDriver;
}
public bool IsProductList
{
get
{
return products != null; // always true.
}
}
// other stuff
}
我通过填充它t在页面上。
我该如何检查存在?
我已经结束了使用产品的列表,而不是像第一个例子中的容器。我会尝试第二个,看起来它有承诺。 – NikolaiDante