title: Not able to call the properties of two separate classes from TestNG Class ->java.lang.NullPointerException
body: <p>I have 2 classes</p>
  
  <p>1.BROWSER--- This class has methods for loading browser so that i can call in my every test case
  2.LOCATORS --This class contains methods for storing all webelements</p>
  
  <p>3.NEW TEST-This is my test case, in which i have called "browser" and "locators" class...</p>
  
  <p>Below is my Browser class</p>
  
  <p>BROWSER CLASS</p>
  
  <pre><code>package TestProject.TestProject;
  
  import java.util.concurrent.TimeUnit;
  
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;
  
  public class Browser {
  
      WebDriver driver;
  
  public Browser (WebDriver driver) {
  
      this.driver = driver;
  }
  
  
  public   WebDriver  GetBrowser() 
  
      {
  
           System.setProperty("webdriver.chrome.driver",  "E:\\chromedriver.exe");
  
           driver = new ChromeDriver();
           String baseurl = "https:\\live.guru99.com\\index.php\\";
           driver.get(baseurl);
           driver.manage().window().maximize();
          driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
          return driver;
      }
  
  
  
  
  
  }
  </code></pre>
  
  <p>Below is my Locator class</p>
  
  <pre><code>package TestProject.TestProject;
  
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  
  public class Locators {
  
      WebDriver driver;
  
      //Locators
      By mobile =  By.xpath("//a[contains(.,'Mobile')]");
  
  
      public Locators (WebDriver driver){
  
          this.driver = driver;
  
  
      }
  
      public void mobile() 
  
      {
       driver.findElement(mobile).click();
      }
  
  }
  </code></pre>
  
  <p>MY TEST CASE</p>
  
  <pre><code>package TestProject.TestProject;
  
  import org.testng.annotations.Test;
  import org.testng.annotations.BeforeTest;
  import java.util.concurrent.TimeUnit;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.testng.annotations.AfterTest;
  
  
  public class NewTest {
  
      WebDriver driver;
  
  
        @BeforeTest
        public void beforeTest() {
  
            Browser load = new Browser(driver);
           driver =load.GetBrowser();
        }
  
  
  
    @Test
    public void   VerifyMobile() {
  
        Locators mobilemenu = new Locators(driver);
              mobilemenu.mobile();
    }
  
  
  
    @AfterTest
    public void afterTest() {
  
  
    }
  
  }
  </code></pre>