title: How to define a @findBy annotation in a subclass, using PageFactory?
body: <p>I work in an automation project with Selenium and C #.
  I use the Page Object pattern to define each of the pages (with their locators), and then define the tests separately in a Test class.
  I have a Page class that is the base class of the pages, where I call:
  PageFactory.InitElements (webDriver, this);</p>
  
  <p>and define the common methods for all the pages.
  Then each page inherits from Page, and the corresponding elements are defined using @FindBy annotations:</p>
  
  <pre><code>[FindsBy (How = How.Id, Using = "UserName")]
  public IWebElement UserName {get; set; }
  
  [FindsBy(How = How.Id, Using = "UserPass")]
  public IWebElement Password { get; set; }
  
  [FindsBy(How = How.Id, Using = "login-btn")]
  public IWebElement SubmitButton { get; set; }
  </code></pre>
  
  <p>A new login page was added, and I have to keep both (new and old login) and be able to run the tests with both pages.
  Both pages have the <strong>same elements (not the locators)</strong>, and they must be able to <strong>respond to the same methods</strong> such as: login (user, pass)
  The idea would be to define a hierarchy of classes: BaseLogin (inherited from Page), LoginPage and NewLoginPage (both inherit from BaseLogin), where in BaseLogin you can define the elements (IWebElement) and the common methods.
  Then in each subclass associate / relate each element with the corresponding locator.</p>
  
  <p><strong>This is to avoid repeating the code that allows me to interact with the page, on each of the pages.</strong></p>
  
  <pre><code>public class BaseLoginPage : Page
  {
   protected IWebElement UserName { get; set; }
   protected IWebElement Password { get; set; }
   protected IWebElement SubmitButton { get; set; }
  }
      // BaseLogin just define the IWebElement without assign a specific locator.
  </code></pre>
  
  <p><strong>How can I associate/relate the element "IWebElement UserName" with its corresponding locator?</strong></p>
  
  <pre><code>[FindsBy(How = How.Id, Using = "UserName")]   --&gt; in LoginPage Class
  [FindsBy(How = How.Id, Using = "user")]       --&gt; in NewLoginPage Class
  </code></pre>