我在运行这个简单的测试时遇到了这个问题。虽然我已对网页进行了初始化,但我null
的{{1}}仍然出现SearchContext
错误。
PropertyCollection.cs
locator
EAPageObject.cs
namespace automation2
{
enum PropertyType
{
Id,
Name,
LinkText,
CssName,
ClassName
}
class PropertyCollection
{
public static IWebDriver driver { get; set; }
}
}
Program.cs的
namespace automation2
{
class EAPageObject
{
public EAPageObject()
{
PageFactory.InitElements(PropertyCollection.driver, this);
}
[FindsBy(How = How.Id, Using = "TitleId")]
public IWebElement TitleId { get; set; }
[FindsBy(How = How.Name, Using = "Initial")]
public IWebElement TextBox { get; set; }
[FindsBy(How = How.Id, Using = "Save")]
public IWebElement Button { get; set; }
}
}