I am using Selenium WebDriver with Java.

I have an Excel spreadsheet with two columns, one for username and another for password. I need to read those values and use them to create new users.

  • 4
    Have you searched online? This seems to me the kind of basic task (reading values from a spreadsheet) that would have many examples you could use as a guideline. – Kate Paulk May 12 '14 at 11:47
  • 1
    As I see it, this question is not about testing, but (as Kate Paulk mentioned above) about reading Excel file in Java (and then possibly filling two fields with read values), which is extremely basic homework task and should not polluting signal in exchange. – Peter M. - stands for Monica May 12 '14 at 23:05
  • 2
    This question appears to be off-topic because it is about reading Excel files with Java – Niels van Reijmersdal Jun 11 '14 at 15:10
  • Agree, off-topic. @obulisaravanan - this question on Stack Overflow might help stackoverflow.com/questions/1516144/… , or you can just search for "read excel java" for a lot of different results: stackoverflow.com/search?q=read+excel+java – testerab Jun 14 '14 at 5:11

Well, it depends on the type of excel file. If it is a standard excel file, there is great instructions on reading them here.

If it is a CSV based excel file than treat it as reading a standard text file and do a comma (Or whatever delimiter it uses) as a split. Instructions can be found here.

After you have the data, I would personally store them to a hashmap or some other system to track the value pair and then loop through the hashmap (Key being username, value being password) using a .keySet() and then check for those values.


I wrote an example project that uses Java and runs your tests on SauceLabs. In this example I drive the tests from a .CSV spreadsheet. You could easily edit this project to do your required testing and then you can hook the test up to a Jenkins job to run them on a scheduled basis.

Not the answer you're looking for? Browse other questions tagged or ask your own question.