title: How to pass selenium webdriver instance to another class
body: <p>I browsed through the site but did not find the answer I am looking.</p>
  
  <p>I have </p>
  
  <ol>
  <li>Superbase class- here I just create object of a webdriver</li>
  <li>Baseclass- In this class I extend Superbase class, invoke the driver, and open the URL.</li>
  <li>Clicklink class- In this class, I again extend the Superbase Class but only to find a null pointer exception. I think I am getting the exception as the driver object is not initialized.</li>
  </ol>
  
  <p>I am just a beginner, and have not tried the browserfactory and other options, as I want to start with simple flow.</p>
  
  <p>Superclass </p>
  
  <pre><code>    Public class Superclass
      {
  public webdriver Driver;
  }
  </code></pre>
  
  <p>Baseclass</p>
  
  <pre><code>public class Baseclass extends Superclass
  {
  setting capabilities and launching the browser
  }
  </code></pre>
  
  <p>ClickLink</p>
  
  <pre><code>public class Clicklink extends Superclass
  {
  here I want to click on a link
  driver.findelement(by.xpath("xpath").click());
  // after this statement I get a null pointer exception
  }
  </code></pre>
  
  <p>Can you please guide me here? how can I achieve the same.</p>
  
  <p>Thanks much!</p>