title: NullPointerException while trying to findelements
body: <p>I have created two classes in one package.In first class, i have added some functions and in second class, i have called those methods and also added some more script.</p>
  
  <pre><code>        package vma;
  
          import org.openqa.selenium.By;
          import org.openqa.selenium.WebDriver;
          import org.openqa.selenium.firefox.FirefoxDriver;
  
          import org.testng.Assert;
          import org.testng.annotations.*;
  
  
          public class Vehicles {
          static WebDriver driver2;
          @BeforeTest
          public static void start() throws InterruptedException
          {Login.setup(driver2,"FF","S","FS");
          }
          @Test
          public static void step1() throws InterruptedException
          { 
          Thread.sleep(7000);
          driver2.findElement(By.xpath("//div[@class='mainContainer']/div/div/div[2]/div/ul/li[7]/h3/a")).click();
          driver2.findElement(By.name("make")).sendKeys("AA");
          driver2.findElement(By.name("model")).sendKeys(Model);
          driver2.findElement(By.id("idNext")).click();
          Thread.sleep(3000);
          }
          }
  </code></pre>
  
  <p>Now when i run this script.@BeforeTest script run successfully but @Test script gets failed.Error: java.lang.NullPointerException occured.Please guys help me that where i am wrong or what i missed in script.
  Exception:</p>
  
  <pre><code>FAILED: step1
  java.lang.NullPointerException
      at vma.Vehicles.step1(Vehicles.java:35)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
      at org.testng.TestNG.run(TestNG.java:1036)
      at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
  
  
  
      Thanks in advance.
  </code></pre>