title: Cannot instantiate class packageName.pageName
body: <p>I am getting "Cannot instantiate class packageName.pageName" will trying to execute the test cases in selenium. I tried a lot but didn't find the the place where i am doing the mistake.</p>
  
  <p>Below is my Login page </p>
  
  <pre><code>package detailsPkg_user;
  
  public class Login {
      public static WebDriver driver;
      String username = "userName";
      String password = "passWord";
      String baseurl = "http://mybusiness.com/login.aspx";
      WebDriverWait wait = new WebDriverWait(driver, 10); // 10 seconds
  
  
  public class Details {  
      @Test(priority = 0)
      public void loginpage() {
  
          System.setProperty("webdriver.chrome.driver","D:\\From H\\Selenium Package\\ChromeDriver\\chromedriver_win32\\chromedriver.exe");
          DesiredCapabilities capabilities = DesiredCapabilities.chrome();
          capabilities.setCapability("chrome.switches", Arrays.asList("--incognito"));
          ChromeOptions options = new ChromeOptions();
          options.addArguments("--test-type");
          options.addArguments("--disable-extensions");
          capabilities.setCapability("chrome.binary","D:\\From H\\Selenium Package\\ChromeDriver\\chromedriver_win32\\chromedriver.exe");
          capabilities.setCapability(ChromeOptions.CAPABILITY, options);
  
          driver = new ChromeDriver(capabilities);
          driver.manage().deleteAllCookies();
          driver.manage().window().maximize();
          driver.get(baseurl);
  
  
          WebElement username = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("UserName")));
          username.sendKeys(userName);
  
          WebElement password = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("PassWord")));
          password.sendKeys(passWord);
  
          WebElement button = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("ButtonClick")));
          button.click();
  
      }
  
      // Selecting a date from date picker
      @Test(priority = 1)
      public void RecordSearch() {
          WebElement calendar = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("CalendarId")));
          calendar.click();
  
  
          WebElement month = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("XPath")));
          month.click();
  
  
          WebElement day = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("XPath")));
          day.click();
  
  
          WebElement submit = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("Submit")));
          submit.click();
  
  
      }
  
          driver.close();
  }
  </code></pre>
  
  <p>And Below is the detailSearch page code</p>
  
  <pre><code> package detailsPkg_user;
  
  
  import org.testng.annotations.Test;
  import java.util.Arrays;
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.chrome.ChromeOptions;
  import org.openqa.selenium.remote.DesiredCapabilities;
  import org.openqa.selenium.support.ui.ExpectedConditions;
  import org.openqa.selenium.JavascriptExecutor;
  
  
  
  public class detailSearch extends Login {
  
      @Test(priority = 2)
      public void loginpageDetail() { 
  
          System.setProperty("webdriver.chrome.driver","D:\\From H\\Selenium Package\\ChromeDriver\\chromedriver_win32\\chromedriver.exe");
          DesiredCapabilities capabilities = DesiredCapabilities.chrome();
          capabilities.setCapability("chrome.switches", Arrays.asList("--incognito"));
          ChromeOptions options = new ChromeOptions();
          options.addArguments("--test-type");
          options.addArguments("--disable-extensions");
          capabilities.setCapability("chrome.binary","D:\\From H\\Selenium Package\\ChromeDriver\\chromedriver_win32\\chromedriver.exe");
          capabilities.setCapability(ChromeOptions.CAPABILITY, options);
  
          driver = new ChromeDriver(capabilities);
          driver.manage().deleteAllCookies();
          driver.manage().window().maximize();
          driver.get(baseurl);
  
  
  
          WebElement username = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("UserName")));
          username.sendKeys(userName);
  
          WebElement password = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("Password")));
          password.sendKeys(passWord);
  
          WebElement button = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("ButtonClick")));
          button.click();
      }   
  
      // Selecting and clicking DetailSearch menu
      @Test(priority = 3) 
      public void detailSelect() {    
          WebElement detailMenu = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("XPath")));
          detailMenu.click();
  
  
  
          // Datepicker of "From" calendar
          WebElement datepickerFrom = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("calendarId01")));
          datepickerFrom.click();
  
  
          WebElement monthPreviousFrom = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("leftarrow_calendar_NP']/img")));
          monthPreviousFrom.click();
  
  
          WebElement dayFirst = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("XPath")));
          dayFirst.click();
  
  
          // Datepicker of "To" calendar
          WebElement datepickerTo = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("calendarId02")));
          datepickerTo.click();
  
  
          WebElement monthPreviousTo = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("leftarrow_calendar_NP']/img")));
          monthPreviousTo.click();
  
  
          WebElement monthLast = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("XPath")));
          monthLast.click();
  
      }
  
          // Click "Submit"
          WebElement submit = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("ctl00_contentMiddle_btnSearch")));
          submit.click();
  
  
          WebElement logout = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("XPath")));
          logout.click();
  
          driver.close();
      }
  
  }
  </code></pre>
  
  <p>When i am trying to execute the project. I am getting the following error in the console.</p>
  
  <pre><code>    org.testng.TestNGException: 
  Cannot instantiate class detailsPkg_user.detailSearch
      at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:40)
      at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:382)
      at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:295)
      at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:118)
      at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:183)
      at org.testng.internal.TestNGClassFinder.&lt;init&gt;(TestNGClassFinder.java:128)
      at org.testng.TestRunner.initMethods(TestRunner.java:416)
      at org.testng.TestRunner.init(TestRunner.java:242)
      at org.testng.TestRunner.init(TestRunner.java:212)
      at org.testng.TestRunner.&lt;init&gt;(TestRunner.java:166)
      at org.testng.remote.support.RemoteTestNG6_9_7$1.newTestRunner(RemoteTestNG6_9_7.java:26)
      at org.testng.remote.support.RemoteTestNG6_9_7$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_9_7.java:59)
      at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:587)
      at org.testng.SuiteRunner.init(SuiteRunner.java:161)
      at org.testng.SuiteRunner.&lt;init&gt;(SuiteRunner.java:114)
      at org.testng.TestNG.createSuiteRunner(TestNG.java:1290)
      at org.testng.TestNG.createSuiteRunners(TestNG.java:1277)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1131)
      at org.testng.TestNG.run(TestNG.java:1048)
      at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
      ... 21 more Caused by: java.lang.NullPointerException
      at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:212)
      at org.openqa.selenium.support.ui.FluentWait.&lt;init&gt;(FluentWait.java:102)
      at org.openqa.selenium.support.ui.WebDriverWait.&lt;init&gt;(WebDriverWait.java:71)
      at org.openqa.selenium.support.ui.WebDriverWait.&lt;init&gt;(WebDriverWait.java:45)
      at detailsPkg_user.Login.&lt;init&gt;(Login.java:25)
      at detailsPkg_user.detailSearch.&lt;init&gt;(CDRSearch.java:21)
      ... 26 more
  </code></pre>