package AppConifiguration; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; import io.github.bonigarcia.wdm.WebDriverManager; public class datadynamic { public static FileInputStream fis; public static FileOutputStream fos; WebDriver driver; String url= "dc.designcollection.in/codecanyon/gsrf-google-sheet-registration-form/registration-from-5.html?ref=designcollection"; @Test public void br() { WebDriverManager.chromedriver().setup(); //WebDriverManager.firefoxdriver().setup(); driver = new ChromeDriver(); driver.manage().window().maximize(); //log.info("open project url"); driver.get(url); driver.findElement(By.xpath("//*[@id=\"testform\"]/div[1]/div[1]/div/input")); } @Test public void data_driven() throws IOException, InterruptedException { fis = new FileInputStream("E:\\book1.xlsx"); XSSFWorkbook wk = new XSSFWorkbook(fis); XSSFSheet sheet = wk.getSheet("Sheet1"); //row count int rownum = sheet.getLastRowNum() +1; //coulmn count int colnum = sheet.getRow(0).getLastCellNum(); // string array variable String [][] data = new String[rownum][colnum]; for (int i = 0; i < rownum; i++) { XSSFRow row = sheet.getRow(i); for (int j = 0; j < colnum; j++) { XSSFCell cell = row.getCell(j); String value= cell.toString(); data [i][j]= value; System.out.println("the value is" + " " + value); } } fos.flush(); fos.close(); } resultthe value is fulll name the value is last name the value is Company name the value is note the value is State the value is city the value is country the value is occupation the value is Email the value is Mobile number the value is DOB the value is Zip code the value is gender the value is are uexisitng customer the value is agree(Yes/No) the value is abc the value is labc the value is cabc the value is nabc the value is abc the value is labc the value is cabc the value is nabc the value is abc the value is labc the value is cabc the value is nabc the value is labc the value is cabc the value is nabc the value is abc 2 the value is abc 2l the value is abc 2C the value is abc 2n the value is abc the value is labc the value is cabc the value is nabc the value is abc the value is labc the value is cabc the value is nabc the value is labc the value is cabc the value is nabc the value is abc 3 the value is abc 2l the value is abc 2C the value is abc 2n the value is abc the value is labc the value is cabc the value is nabc the value is abc the value is labc the value is cabc the value is nabc the value is labc the value is cabc the value is nabc PASSED: br FAILED: data_driven java.lang.NullPointerException at AppConifiguration.datadynamic.data_driven(datadynamic.java:55)