title: Getting first set of data as null value while using data provider in selenium
body: <p>I am trying to fetch the data using data provider in selenium from an excel sheet. When the data is returned/passed on to the caller function, i get null values for the first time even though loop begins from the second row having the actual data. I am not sure why this is happening. </p>
  
  <pre><code>package pageobjectmodel;
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  
  import org.testng.Assert;
  import org.testng.annotations.AfterMethod;
  import org.testng.annotations.BeforeMethod;
  import org.testng.annotations.DataProvider;
  import org.testng.annotations.Test;
  
  import Utils.ReadingExcelfile;
  import Utils.TestBase;
  import pagebasedexecution.LinkedInloginPage;
  
  public class LinkedInLoginTest extends TestBase 
  {
  
  
      //public static ReadExcel excelfile;
      public static ReadingExcelfile excelfile;
      LinkedInloginPage loginPage;
  
  
      public LinkedInLoginTest() throws IOException
      {
          super();
      }
  
      @BeforeMethod
      public void Setup() throws IOException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
      {
          BrowserSetup();
          loginPage = new LinkedInloginPage();
      }
  
  
      @Test(dataProvider="TestData")
      public void LoginTest(String uname, String password) throws InterruptedException
      {
      //  System.out.println("received data is --- " +uname + " , " + password);
          loginPage.LoginIntoAccount(uname, password);
          String title = loginPage.VerifyTitle();
          Assert.assertEquals(title, "LinkedIn", "Unable to login: invalid credentials");
          Thread.sleep(5000);
      }
  
  
      /*@Test(priority=2)
      public void VerifyloginPageTitleTest() throws InterruptedException
      {
          String title = loginPage.VerifyTitle();
          Assert.assertEquals(title, "LinkedIn", "Unable to login: invalid credentials");
      }*/
  
  
      @DataProvider
      public Object[][] TestData() throws IOException 
      {
          excelfile = new ReadingExcelfile(System.getProperty("user.dir")+"\\src\\main\\java\\testData\\LinkedIn.xlsx");
          int rows = excelfile.RowCount(1);
          int colm = excelfile.TotalColm("LoginPage", 0);
  
          Object[][] credentials = new Object[rows][colm];
  
          for(int i = 1; i &lt; rows; i++) 
          {
              for(int j = 0; j&lt;colm; j++) 
              {
                  credentials[i][j] = excelfile.getdata("LoginPage", i, j); 
                  System.out.println("Fetched data from excel sheet is -- "+credentials[i][j]);
              }
          }
          return credentials;
          }
  
      @AfterMethod
      public void closebrowser() 
      {
          System.out.println("quitting browser");
          driver.quit();
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/tPSq9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tPSq9.png" alt="enter image description here"></a></p>
  
  <p>Even though i am fetching the data from second row, somehow it's fetching the data from first row(column names) and first set of data is returned as null, null. i have provided the screenshot of error console and highlighted the error portion. Any help is appreciated. </p>
  
  <p>Thanks</p>