title: How to iterate from first row of excel and try to login and then again iterate to second row and try to login again using Selenium with POI?
body: <p>My scenario is I have an excel with three rows and two columns. First Column is User Name and second column is Password and under which three rows with some data exists.</p>
  
  <p>My target is my webdriver script reads the first row data and tries to login then reads the second row data and again try to login and so on.
  The script I have create is it reads first username and put it in the user Name text box and reads first password and put in password and then try to login and never goes to second row data. My guess is the break I used in the script is not at correct place
  I dont know where I should break the the loop to go from row to row.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>FileInputStream loginFile = new FileInputStream(new File("C:\\Selenium\\Input_Data\\LoginFailure.xlsx"));
  
  //Get the workbook instance for xlsx file
  XSSFWorkbook workbook = new XSSFWorkbook(loginFile);
  
  //Get the first sheet of the xlsx file
  XSSFSheet sheet = workbook.getSheet("Login");
  
  //Iterate through each row from first sheet
  Iterator&lt;Row&gt; rowIterator = sheet.iterator();
  
  while (rowIterator.hasNext())
  {
      Row row = rowIterator.next();
  
      //For each row iterate through each columns
      Iterator &lt;Cell&gt; cellIterator = row.cellIterator();
  
      while (cellIterator.hasNext())
      {
  
          Cell cell = cellIterator.next();
          if(cell.getColumnIndex()==0)
          {
              driver.findElement (By.id("UserName")).sendKeys(cell.getStringCellValue());
          }
          else 
              driver.findElement(By.id("Password")).sendKeys(cell.getStringCellValue());
          }
          break;          
  }
  
  driver.findElement(By.id("LoginButton")).click();
  System.out.println("**********User login failure**********");
  </code></pre>