I want to init some property once and than to use it to find elements in the page using C# with webdriver page object (in java the following code is working), But the following error is shown for using the property containerID :
An object reference is required for the non-static field.
This is my code:
class DescriptionPopUp
{
public string containerID { get; private set; }
[FindsBy(How = How.XPath, Using = String.Format("//div[@id='{0}']//div[@class='close-Button']", containerID))]
public IWebElement CloseButton { get; set; }
public DescriptionPopUp(string containerID)
{
this.containerID = containerID;
}
}
Is there an smart way to handle the problem?