title: Page Class using PageFactory
body: <p>I am new to <code>PageFactory</code> and referring this tutorial <a href="https://www.toptal.com/selenium/test-automation-in-selenium-using-page-object-model-and-page-factory" rel="nofollow">https://www.toptal.com/selenium/test-automation-in-selenium-using-page-object-model-and-page-factory</a></p>
  
  <p>An example from this page:</p>
  
  <pre><code>public class HomePage {
     private WebDriver driver;
  
     //Page URL
     private static String PAGE_URL="https://www.toptal.com";
  
     //Locators
  
     //Apply as Developer Button
     @FindBy(how = How.LINK_TEXT, using = "APPLY AS A DEVELOPER")
     private WebElement developerApplyButton;
  
     //Constructor
     public HomePage(WebDriver driver){
         this.driver=driver;
         driver.get(PAGE_URL);
         //Initialise Elements
         PageFactory.initElements(driver, this);
     }
  
     public void clickOnDeveloperApplyButton(){
  
         developerApplyButton.click();
  
     }
  }
  </code></pre>
  
  <ol>
  <li>Why create a private instance of <code>WebDriver</code>? It is appearing with yellow line for me.</li>
  <li>When to use <code>how = HOW</code> and when we can straight away use <code>xpath= //id..</code>?</li>
  <li>In constructor we are again passing <code>WebDriver</code> parameters?</li>
  </ol>