title: Getting java.lang.NullPointerException when trying to use @FindBy in webDriver
body: <p>I am getting java.lang.NullPointerException when i am trying to find elements on a webpage using @FindBy annotation.</p>
  
  <p>My Code - </p>
  
  <pre><code>public class pageObject{
    WebDriver driver;
  
    @FindBy(id = "email")
    WebElement searchBox;
    @FindBy(id = "u_0_v")
    WebElement submit;
  
    void pageObject(String web){
      FirefoxProfile profile = new FirefoxProfile();
      profile.setAssumeUntrustedCertificateIssuer(false);
      profile.setAcceptUntrustedCertificates(false);
      this.driver = new FirefoxDriver(profile);
      this.driver.get(web);
      this.driver.manage().window().maximize();
      this.driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
      searchBox.click();
      searchBox.sendKeys("er");
      submit.click();
    }
  
    public static void main(String[] args){
      new pageObject("https://www.facebook.com/?_rdr=p");
    }
  }
  </code></pre>
  
  <p>I got an exception for the above code -</p>
  
  <p>Exception -</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
  at com.Selenium_Practice.pageObject.&lt;init&gt;(pageObject.java:29)
  at com.Selenium_Practice.pageObject.main(pageObject.java:35)
  </code></pre>
  
  <p>I also tried to use </p>
  
  <pre><code> @FindBy(how = HOW.ID , using = "email")  and @FindBy(how = HOW.ID , using = "u_0_v")
  </code></pre>
  
  <p>but again got the same null pointer exception</p>