title: Using Hashmap with POI libraries in Selenium
body: <p>I have an xlsx file which contains all the locators to be used in my script. <a href="http://i.stack.imgur.com/LABAD.jpg" rel="nofollow">Excel SnapShot</a></p>
  
  <p>Now to use the Locator and its value I would be using a hashmap. Can someone please help me how to put these values in a hashmap and call them in my selenium script. I have somehow managed to read the excel using POI libraries however not able to figure out how to put them in a hashmap and where to add the cell and rows in hashmap. Also how to call them in my selenium script. </p>
  
  <pre><code>public void readValueFromExcel()
      {
          Iterator&lt;Row&gt; rowiterator=shSheet.iterator();
          while (rowiterator.hasNext())
              {
              HashMap&lt;String, String&gt; xHashmap = new HashMap();
              Row nextRow = rowiterator.next();
              Iterator&lt;Cell&gt; celliterator= nextRow.cellIterator();
                  while (celliterator.hasNext())
                      {
                      Cell nextCell = celliterator.next();
                      switch (nextCell.getCellType())
                          {
                      case Cell.CELL_TYPE_STRING:
                          System.out.print(nextCell.getStringCellValue());
                          break;
                      case Cell.CELL_TYPE_BOOLEAN:
                          System.out.print(nextCell.getBooleanCellValue());
                          break;
                      case Cell.CELL_TYPE_NUMERIC:
                          System.out.print(nextCell.getNumericCellValue());
                          break;
                          }
                      //System.out.print(" - ");
  
                      }
                  //System.out.println();
  
              }
  </code></pre>