1

Is there any way using which I can write output to a csv file using selenium webdriver. Please help

1
  • 1
    Writing output to a csv file is not in any way dependent on Selenium WebDriver. You could simply use java file handling to write into a csv file after every webdriver command gets executed. It's completely your choice the way you want to do it. Also, please go through this Commented Mar 9, 2014 at 18:15

1 Answer 1

1

I believe you want to store your Test results into CSV which can be shown to your fellow members, so you may firstly consider clubbing Selenium with one the of Test frameworks like JUNit, TestNG etc. So after every test is run you can store the values in a common results csv for a particular suite. As @AbhijeetVaikar said, you just need to make use of Java file handling to store out the output you want to.

For example on reading CSV files you can refer this Library link - http://sourceforge.net/projects/opencsv/files/opencsv/

Example code

String csv = "C:\\output.csv";
CSVWriter writer = new CSVWriter(new FileWriter(csv));

String [] country = "India#China#United States".split("#");

writer.writeNext(country);

writer.close();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.