| || |
How to export the values stored in variables to .CSV file. Every time when we execute
Suppose if i have some values like below:
string name = "XXXXXXXX";
int age = 40;
int amount1 = 30000;
int amount2 = 40000;
I am trying to create some tests with webdriver using C#(VS 2010)
Suppose if i have test which I need to export these values to .CSV file. When I execute the same test for second time these values may be different. So i need to export the new values to the same .CSV files. So that i can compare the difference between these values. Please help me to handle this scenario.
webdriver itself doesn't handle CSV. You'll want to find a 3rd party library that can handle that. I'm not familiar with C# so I can't recommend a good one.
As for retrieving the CSV file that gets exported by your webapp. Downloads is a tricky subject in selenium since it doesn't have access to the system. You have a few choices..
* If tests are run on the same machine as the browser, you can search for the expected file in the downloads directory.
dlai is correct. Selenium is an API to driver browser and nothing else.
There are plenty of libraries in various languages to generate an delimited file output. Here's one that I've used in the past and seemed to work reasonably well:
OstermillerUtils Java Utilities - Comma Separated Values (CSV)